forked from LiamAEdwards/SS14-Docker-Linux-Server
Build Docker image from wylab-station-14 source
This commit is contained in:
44
Dockerfile
44
Dockerfile
@@ -1,24 +1,33 @@
|
||||
# Build stage
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
|
||||
# Update and install necessary tools
|
||||
RUN apt-get -y update && \
|
||||
apt-get -y install curl unzip wget git jq
|
||||
ARG SOURCE_REPO=https://git.wylab.me/wylab/wylab-station-14.git
|
||||
ARG SOURCE_REF=master
|
||||
ARG TARGET_PLATFORM=linux-x64
|
||||
|
||||
# Download and extract SS14 server (latest version compatible with .NET 9)
|
||||
# Using manifest to get current server build
|
||||
RUN SERVER_URL=$(curl -sL https://central.spacestation14.io/builds/wizards/manifest.json | \
|
||||
jq -r '.builds | to_entries | sort_by(.value.time) | last | .value.server."linux-x64".url') && \
|
||||
echo "Downloading server from: $SERVER_URL" && \
|
||||
wget -O SS14.Server_linux-x64.zip "$SERVER_URL" && \
|
||||
unzip SS14.Server_linux-x64.zip -d /ss14-default/
|
||||
# Install dependencies needed to build and package the server
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends git python3 unzip && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download and build Watchdog
|
||||
RUN wget https://github.com/space-wizards/SS14.Watchdog/archive/refs/heads/master.zip -O Watchdog.zip && \
|
||||
unzip Watchdog.zip -d Watchdog && \
|
||||
cd Watchdog/SS14* && \
|
||||
dotnet publish -c Release -r linux-x64 --no-self-contained && \
|
||||
cp -r SS14.Watchdog/bin/Release/net9.0/linux-x64/publish /ss14-default
|
||||
WORKDIR /src
|
||||
|
||||
# Clone the wylab-station-14 source
|
||||
RUN git clone "${SOURCE_REPO}" content
|
||||
WORKDIR /src/content
|
||||
RUN git checkout "${SOURCE_REF}"
|
||||
|
||||
# Initialize submodules / engine checkout
|
||||
RUN python3 RUN_THIS.py --quiet
|
||||
|
||||
# Build and package the server for the requested platform
|
||||
RUN dotnet run --project Content.Packaging/Content.Packaging.csproj server \
|
||||
--platform "${TARGET_PLATFORM}" \
|
||||
--configuration Release
|
||||
|
||||
# Extract packaged build into the filesystem layout the runtime stage expects
|
||||
RUN mkdir -p /ss14-default && \
|
||||
unzip "release/SS14.Server_${TARGET_PLATFORM}.zip" -d /ss14-default/
|
||||
|
||||
# Server stage
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS server
|
||||
@@ -26,9 +35,6 @@ FROM mcr.microsoft.com/dotnet/sdk:9.0 AS server
|
||||
# Copy from the build stage
|
||||
COPY --from=build /ss14-default /ss14-default
|
||||
|
||||
# Install necessary tools
|
||||
RUN apt-get -y update && apt-get -y install unzip
|
||||
|
||||
# Expose necessary ports
|
||||
EXPOSE 1212/tcp
|
||||
EXPOSE 1212/udp
|
||||
|
||||
83
README.md
83
README.md
@@ -13,58 +13,69 @@
|
||||
|
||||
### Overview
|
||||
|
||||
This project is for those who prefer containerized solutions. It's based on the [official documentation](https://docs.spacestation14.com/en/general-development/setup/server-hosting-tutorial.html) but wrapped up in a Docker container for convenience.
|
||||
This project is for those who prefer containerized solutions. It's based on the [official documentation](https://docs.spacestation14.com/en/general-development/setup/server-hosting-tutorial.html) but wraps the [wylab-station-14](https://git.wylab.me/wylab/wylab-station-14) fork in a Docker image that is built from source during the Docker build.
|
||||
|
||||
### Quick Start
|
||||
### Building the Image
|
||||
|
||||
1. **Clone the repository**
|
||||
1. **Clone this repository**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/LiamAEdwards/SS14-Docker-Linux-Server.git && cd SS14-Docker-Linux-Server
|
||||
git clone https://git.wylab.me/wylab/WS14-Docker-Linux-Server.git
|
||||
cd WS14-Docker-Linux-Server
|
||||
```
|
||||
|
||||
2. **Configure Your Server**
|
||||
2. **Configure your server defaults**
|
||||
|
||||
Edit the `appsettings.yml` & `server_config.toml` to match your desired configuration.
|
||||
Edit `appsettings.yml` and `server_config.toml` with the values you want baked into the image. These files will be copied into `/ss14-default/publish` on first run.
|
||||
|
||||
3. **Run the Server**
|
||||
|
||||
Using Docker directly:
|
||||
3. **Build the Docker image**
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
-p 1212:1212/tcp \
|
||||
-p 1212:1212/udp \
|
||||
-p 5000:5000/tcp \
|
||||
-p 5000:5000/udp \
|
||||
-v /path/on/host:/ss14 \
|
||||
ghcr.io/liamaedwards/ss14-docker-linux-server:main
|
||||
docker build \
|
||||
--build-arg SOURCE_REPO=https://git.wylab.me/wylab/wylab-station-14.git \
|
||||
--build-arg SOURCE_REF=master \
|
||||
--build-arg TARGET_PLATFORM=linux-x64 \
|
||||
-t wylab-ss14-server .
|
||||
```
|
||||
|
||||
Or using Docker Compose:
|
||||
- `SOURCE_REPO` – Git URL of the content repo to compile (defaults to the wylab fork).
|
||||
- `SOURCE_REF` – Branch, tag, or commit to check out (defaults to `master`).
|
||||
- `TARGET_PLATFORM` – Runtime identifier passed to the packaging tool (defaults to `linux-x64`).
|
||||
|
||||
First, create a `docker-compose.yml` file:
|
||||
The build container clones the selected ref, runs `RUN_THIS.py --quiet` to fetch submodules, and executes `dotnet run --project Content.Packaging server` to generate a release zip that is baked into the final layer.
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
### Running the Server
|
||||
|
||||
services:
|
||||
ss14-server:
|
||||
image: ghcr.io/liamaedwards/ss14-docker-linux-server:main
|
||||
ports:
|
||||
- "1212:1212/tcp"
|
||||
- "1212:1212/udp"
|
||||
- "5000:5000/tcp"
|
||||
- "5000:5000/udp"
|
||||
volumes:
|
||||
- /path/on/host:/ss14
|
||||
restart: always
|
||||
```
|
||||
```bash
|
||||
docker run -d \
|
||||
-p 1212:1212/tcp \
|
||||
-p 1212:1212/udp \
|
||||
-p 5000:5000/tcp \
|
||||
-p 5000:5000/udp \
|
||||
-v /path/on/host:/ss14 \
|
||||
--name wylab-ss14 \
|
||||
wylab-ss14-server
|
||||
```
|
||||
|
||||
Then, run with:
|
||||
On first start the container copies `/ss14-default` into your mounted volume (if empty) so you can edit configs or upload new builds persistently.
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
You can still wrap the container in Docker Compose if desired:
|
||||
|
||||
```yaml
|
||||
version: '3.9'
|
||||
|
||||
services:
|
||||
ss14-server:
|
||||
image: wylab-ss14-server
|
||||
build: .
|
||||
ports:
|
||||
- "1212:1212/tcp"
|
||||
- "1212:1212/udp"
|
||||
- "5000:5000/tcp"
|
||||
- "5000:5000/udp"
|
||||
volumes:
|
||||
- /path/on/host:/ss14
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user