diff --git a/CirclesLand.Pathfinder.sln b/CirclesLand.Pathfinder.sln index 07cf860..98b4724 100644 --- a/CirclesLand.Pathfinder.sln +++ b/CirclesLand.Pathfinder.sln @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Other", "Other", "{E58EABF4 .env = .env sequence.puml = sequence.puml sequence.png = sequence.png + ExportUtil.Dockerfile = ExportUtil.Dockerfile EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CirclesUBI.PathfinderUpdater.IndexerWebsocket", "CirclesUBI.PathfinderUpdater.IndexerWebsocket\CirclesUBI.PathfinderUpdater.IndexerWebsocket.csproj", "{92CEC307-4134-4027-B988-55BCEF8693B9}" diff --git a/ExportUtil.Dockerfile b/ExportUtil.Dockerfile new file mode 100644 index 0000000..5e8619f --- /dev/null +++ b/ExportUtil.Dockerfile @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS publish +ENV DOTNET_EnableDiagnostics=0 +WORKDIR /app +COPY . . +RUN cd CirclesUBI.PathfinderUpdater.Updater && dotnet restore "CirclesUBI.PathfinderUpdater.Updater.csproj" +RUN cd CirclesUBI.PathfinderUpdater.Updater && dotnet build "CirclesUBI.PathfinderUpdater.Updater.csproj" -c Release -o /app/build +RUN cd CirclesUBI.PathfinderUpdater.Updater && dotnet publish "CirclesUBI.PathfinderUpdater.Updater.csproj" -c Release -o /app/publish + +FROM mcr.microsoft.com/dotnet/runtime:8.0 +LABEL org.opencontainers.image.source=https://github.com/circlesland/pathfinder2-updater +ENV DOTNET_EnableDiagnostics=0 + +WORKDIR /app +COPY --from=publish /app/publish . +RUN chmod +x ./CirclesUBI.PathfinderUpdater.ExportUtil +ENTRYPOINT ["./CirclesUBI.PathfinderUpdater.ExportUtil"] diff --git a/readme.md b/readme.md index e1db779..20d7111 100644 --- a/readme.md +++ b/readme.md @@ -54,7 +54,7 @@ locations._ ### Start the environment -On first start, it pulls the pathfinder2 image and builds the pathfinder2-updater image. +On first start, it pulls the pathfinder2 image and builds the pathfinder2-updater image from source. ```shell docker-compose up @@ -66,16 +66,28 @@ Alternatively, you can use the updater as a command line utility. This allows you to dump the index db data to a file and load it into the pathfinder2 instance manually. ```shell -CirclesUBI.PathfinderUpdater.ExportUtil.exe \ - "/home/user/pathfinder-db.bin" \ - "Server=localhost;Port=5432;Database=postgres;User Id=postgres;Password=postgres;" \ - "v2" +# Build the image +docker build -f ExportUtil.Dockerfile -t pathfinder2-export-util:latest . + +# ########################################### # +# Define your out path and connection string # +# ########################################### # +OUTPUT_DIR="/home/user" +OUTPUT_FILENAME="pathfinder-db.bin" +INDEXER_DB_CONNECTION_STRING="Server=localhost;Port=5432;Database=postgres;User Id=postgres;Password=postgres;" +CIRCLES_VERSION="v2" + +# Run the ExportUtil to dump the index db data to a file +docker run --rm \ + -v ${OUTPUT_DIR}:/output \ + --network host \ + pathfinder2-export-util:latest \ + "/output/${OUTPUT_FILENAME}" \ + "${INDEXER_DB_CONNECTION_STRING}" \ + "${CIRCLES_VERSION}" ``` -The first argument is the output path for the binary dump file, the second argument is the connection string to the -index db and the third argument is the Circles version. - -You can then use the resulting file to initialize a pathfinder2 instance: +You can then use the resulting file (at "${OUTPUT_DIR}/${OUTPUT_FILENAME}") to initialize a pathfinder2 instance: ```shell curl -X POST \ @@ -87,7 +99,7 @@ curl -X POST \ "file": "/home/user/pathfinder-db.bin" } }' \ - "http://:" + "http://localhost:8080" ``` ## File format