diff --git a/Dockerfile b/Dockerfile index 79c7ba65..3b551ab9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,13 @@ WORKDIR /App COPY Source Source # Restore as distinct layers -RUN dotnet build Source/Server/GameServer.csproj --configuration Release /property:WarningLevel=0 +RUN dotnet publish Source/Server/GameServer.csproj -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:PublishReadyToRun=true -p:WarningLevel=0 # Build runtime image FROM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /App -COPY --from=build-env /App/Source/Server/bin/Release/net8.0 /App/Server +COPY --from=build-env /App/Source/Server/bin/Release/net8.0/linux-x64/publish/GameServer /App/Server/GameServer WORKDIR /Data @@ -19,4 +19,4 @@ VOLUME /Data EXPOSE 25555/tcp -ENTRYPOINT ["/App/Server/GameServer"] \ No newline at end of file +ENTRYPOINT ["/App/Server/GameServer"] diff --git a/Makefile b/Makefile index 3f7cde10..cfbdb984 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,3 @@ build-server: build-client: dotnet build Source/Client/GameClient.csproj --configuration Release /property:WarningLevel=0 - -build-container: - buildah build -t rwt:latest . - -run-container: - mkdir -p Data - podman run -it --rm -v $$(pwd)/Data:/Data:Z -p 25555:25555 rwt:latest \ No newline at end of file diff --git a/README.md b/README.md index 8aba11d3..e28cb9d0 100644 --- a/README.md +++ b/README.md @@ -16,18 +16,36 @@ Download the latest server files at [here](https://github.com/Byte-Nova/Rimworld > When extracting the server files somewhere, be mindful on where this location might be, avoid installing it at privileged locations (where admin permissions are needed) to prevent your antivirus/system kicking off. ## Container-based Deployment: -We provide helper scripts to build and run the official RimWorld-Together Container with [buildah](https://github.com/containers/buildah) and [podman](https://github.com/containers/podman) +We provide a Dockerfile to build and run the official RimWorld-Together Container with [docker](https://www.docker.com/) , or [buildah](https://github.com/containers/buildah) and [podman](https://github.com/containers/podman) +`GameServer` exucutable is located in the `/App/Server` directory. +the *Data* volume contains all server files and is located at `/Data` inside the container. + +### Build with Docker +**Build:** +```sh +docker build -f Dockerfile -t rwt:latest . +``` + +**Run:** +```sh +mkdir -p Data +docker run -it --rm -v $$(pwd)/Data:/Data -p 25555:25555 rwt:latest +``` + +### Build with buildah/podman **Build:** ```sh -make build-container +buildah build -t rwt:latest . ``` **Run:** ```sh -make run-container +mkdir -p Data +podman run -it --rm -v $$(pwd)/Data:/Data:Z -p 25555:25555 rwt:latest ``` + ## Contributing Interested? Please read our [contribution guide](https://github.com/RimworldTogether/Rimworld-Together/blob/development/.github/CONTRIBUTING.md) before contributing!