forked from LiamAEdwards/SS14-Docker-Linux-Server
- Watchdog automatically downloads and updates game server from CDN manifest - No need to rebuild image for game updates - Game server binaries pulled from https://cdn.wylab.me/fork/wylab/manifest - Dev branch retains the build-from-source approach
63 lines
1.5 KiB
Docker
63 lines
1.5 KiB
Docker
#
|
|
# SS14 Watchdog Docker Image
|
|
# Auto-updates game server from CDN manifest
|
|
#
|
|
# syntax=docker/dockerfile:1.7
|
|
|
|
# Build stage - compile the watchdog
|
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends git && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /src
|
|
|
|
# Clone and build SS14.Watchdog
|
|
RUN git clone --recursive https://github.com/space-wizards/SS14.Watchdog.git watchdog
|
|
|
|
WORKDIR /src/watchdog
|
|
|
|
# Build for the target platform
|
|
RUN --mount=type=cache,target=/root/.nuget/packages \
|
|
if [ "${TARGETPLATFORM:-linux/amd64}" = "linux/arm64" ]; then \
|
|
RUNTIME="linux-arm64"; \
|
|
else \
|
|
RUNTIME="linux-x64"; \
|
|
fi && \
|
|
dotnet publish SS14.Watchdog -c Release -r "$RUNTIME" --no-self-contained -o /app
|
|
|
|
# Runtime stage
|
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends ca-certificates && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy watchdog from build stage
|
|
COPY --from=build /app /app
|
|
|
|
WORKDIR /app
|
|
|
|
# Create instance directory structure
|
|
RUN mkdir -p /app/instances/wylab/data
|
|
|
|
# Copy configuration files
|
|
COPY appsettings.yml /app/appsettings.yml
|
|
COPY server_config.toml /app/instances/wylab/config.toml
|
|
|
|
# Expose ports
|
|
# 8080 = Watchdog API
|
|
# 1212 = Game server (TCP status + UDP game)
|
|
EXPOSE 8080/tcp
|
|
EXPOSE 1212/tcp
|
|
EXPOSE 1212/udp
|
|
|
|
# Volume for persistent data (game saves, database, etc.)
|
|
VOLUME ["/app/instances"]
|
|
|
|
# Run the watchdog
|
|
ENTRYPOINT ["./SS14.Watchdog"]
|