Files
WS14-Docker-Linux-Server/Dockerfile
2025-12-14 05:13:39 +01:00

55 lines
1.4 KiB
Docker

# Build stage
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG SOURCE_REPO=https://git.wylab.me/wylab/wylab-station-14.git
ARG SOURCE_REF=master
ARG TARGET_PLATFORM=linux-x64
# 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/*
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
# Copy from the build stage
COPY --from=build /ss14-default /ss14-default
# Expose necessary ports
EXPOSE 1212/tcp
EXPOSE 1212/udp
EXPOSE 8080/tcp
# Set volume
VOLUME [ "/ss14" ]
# Add configurations
ADD appsettings.yml /ss14-default/publish/appsettings.yml
ADD server_config.toml /ss14-default/publish/server_config.toml
COPY start.sh /start.sh
RUN chmod +x /start.sh
# Set the entry point for the container
ENTRYPOINT ["/start.sh"]