Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile refactor #195

Open
wants to merge 9 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ 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

VOLUME /Data

EXPOSE 25555/tcp

ENTRYPOINT ["/App/Server/GameServer"]
ENTRYPOINT ["/App/Server/GameServer"]
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down