Improve/add initial project structure for ZomboidForge with build system, runtime, and patching logic.
Added version support for building images.
This commit is contained in:
1 parent
bf9228d2be
commit
015e9bb2c8
32 files changed
+1268
-58
No files matched your search
+46
-6
@@ -4,9 +4,22 @@
|
||||
# contains no game files.
|
||||
#
|
||||
# podman build --platform linux/amd64 -t zomboidforge .
|
||||
# podman build --build-arg PZ_BRANCH=unstable ... # non-public Steam branch
|
||||
# podman build --build-arg PZ_BRANCH=42.19 --build-arg PZ_VERSION=42.19 ...
|
||||
#
|
||||
# Build arguments:
|
||||
# PZ_BRANCH Steam branch of app 380870: public, unstable, or a version branch (42.19, ...)
|
||||
# PZ_VERSION Expected Project Zomboid version; the build fails when the downloaded
|
||||
# server reports another one. Default: pz.version in gradle.properties
|
||||
# STEAMCLIENT bundled (default) or steamcmd: replace the server's steamclient.so
|
||||
# files with steamcmd's newer copies
|
||||
# FORGE_VERSION Image label only; set by ci/release.sh
|
||||
# STEAM_BUILDID Image label only; set by ci/release.sh
|
||||
|
||||
ARG PZ_BRANCH=public
|
||||
ARG PZ_VERSION=""
|
||||
ARG STEAMCLIENT=bundled
|
||||
ARG FORGE_VERSION=""
|
||||
ARG STEAM_BUILDID=""
|
||||
|
||||
# --- Stage 1: vanilla dedicated server -----------------------------------------
|
||||
FROM docker.io/steamcmd/steamcmd:debian-13 AS server
|
||||
@@ -16,8 +29,9 @@ FROM docker.io/steamcmd/steamcmd:debian-13 AS server
|
||||
RUN steamcmd +quit
|
||||
|
||||
ARG PZ_BRANCH
|
||||
ARG STEAMCLIENT
|
||||
COPY docker/install-server.sh /usr/local/bin/install-server
|
||||
RUN install-server /server "${PZ_BRANCH}"
|
||||
RUN install-server /server "${PZ_BRANCH}" "${STEAMCLIENT}"
|
||||
|
||||
# --- Stage 2: ZomboidForge build and server jar patching -----------------------
|
||||
FROM docker.io/library/eclipse-temurin:25-jdk AS build
|
||||
@@ -30,19 +44,28 @@ RUN ./gradlew --no-daemon --version
|
||||
|
||||
COPY build-logic build-logic
|
||||
COPY api api
|
||||
COPY core core
|
||||
COPY compat compat
|
||||
COPY agent agent
|
||||
COPY patcher patcher
|
||||
COPY --from=server /server/java/projectzomboid.jar /pz/projectzomboid.jar
|
||||
RUN ./gradlew --no-daemon -Ppz.jar=/pz/projectzomboid.jar build :patcher:patchServerJar
|
||||
|
||||
# An empty PZ_VERSION keeps pz.version from gradle.properties.
|
||||
ARG PZ_VERSION
|
||||
RUN ./gradlew --no-daemon \
|
||||
-Ppz.jar=/pz/projectzomboid.jar \
|
||||
${PZ_VERSION:+-Ppz.version=${PZ_VERSION}} \
|
||||
build :patcher:patchServerJar
|
||||
|
||||
# --- Stage 3: runtime ------------------------------------------------------------
|
||||
FROM docker.io/library/debian:trixie-slim
|
||||
|
||||
# ca-certificates: required by steamclient.so to connect to Steam. Unpinned so
|
||||
# the image picks up the current Debian CA bundle.
|
||||
# ca-certificates: required by steamclient.so to connect to Steam.
|
||||
# sqlite3: the entrypoint checks the admin account in the server database.
|
||||
# Unpinned so the image picks up current Debian security updates.
|
||||
# hadolint ignore=DL3008
|
||||
RUN apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends ca-certificates \
|
||||
&& apt-get install --yes --no-install-recommends ca-certificates sqlite3 \
|
||||
&& rm --recursive --force /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd --create-home --uid 1000 pz \
|
||||
@@ -54,6 +77,23 @@ COPY --from=build /src/patcher/build/server/projectzomboid.jar /opt/pz/java/proj
|
||||
COPY --from=build /src/agent/build/libs/zomboidforge-agent-*.jar /opt/pz/zomboidforge-agent.jar
|
||||
COPY docker/entrypoint.sh /usr/local/bin/entrypoint
|
||||
|
||||
# Steam downloads Workshop items into <install dir>/steamapps/workshop. /opt/pz is
|
||||
# owned by root, so steamapps points into the data volume, which also keeps the
|
||||
# downloads across container recreation.
|
||||
RUN ln --symbolic /data/steamapps /opt/pz/steamapps
|
||||
|
||||
ARG PZ_BRANCH
|
||||
ARG PZ_VERSION
|
||||
ARG FORGE_VERSION
|
||||
ARG STEAM_BUILDID
|
||||
|
||||
LABEL org.opencontainers.image.title="ZomboidForge" \
|
||||
org.opencontainers.image.description="Project Zomboid dedicated server with Java mod support." \
|
||||
org.opencontainers.image.version="${FORGE_VERSION}" \
|
||||
dev.overlord.zomboidforge.pz-version="${PZ_VERSION}" \
|
||||
dev.overlord.zomboidforge.steam-branch="${PZ_BRANCH}" \
|
||||
dev.overlord.zomboidforge.steam-buildid="${STEAM_BUILDID}"
|
||||
|
||||
USER 1000:1000
|
||||
VOLUME /data
|
||||
# 16261/udp game, 16262/udp direct connect, 27015/tcp RCON
|
||||
|
||||
Reference in new issue
Block a user