Add Docker build system for ZomboidForge with containerized server setup, Gradle build logic, and project configuration.

This commit is contained in:
Overlord committed 2026-09-28 23:12:57 +02:00
1 parent d4c5a9d45f
commit bf9228d2be
18 files changed
+747 -55

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
#
# Installs the vanilla Project Zomboid dedicated server (Steam app 380870)
# with steamcmd, using an anonymous login. Runs in the steamcmd image during
# the Docker build.
#
# Usage: install-server.sh <install-dir> <branch>
# <branch> Steam branch; "public" is the default branch.
set -o errexit
set -o nounset
set -o pipefail
readonly APP_ID="380870"
readonly MAX_ATTEMPTS=3
readonly INSTALL_DIR="$1"
readonly BRANCH="$2"
log() {
echo "[install-server] $*" >&2
}
main() {
local branch_args=()
if [[ "${BRANCH}" != "public" ]]; then
branch_args=("-beta" "${BRANCH}")
fi
# app_update can fail with "Missing configuration" right after steamcmd
# updated itself; a repeated attempt succeeds.
local attempt
for (( attempt = 1; attempt <= MAX_ATTEMPTS; attempt++ )); do
log "Installing app ${APP_ID} (branch ${BRANCH}), attempt ${attempt}/${MAX_ATTEMPTS}"
if steamcmd \
+force_install_dir "${INSTALL_DIR}" \
+login anonymous \
+app_update "${APP_ID}" "${branch_args[@]}" validate \
+quit
then
break
fi
log "steamcmd failed on attempt ${attempt}"
done
if [[ ! -f "${INSTALL_DIR}/java/projectzomboid.jar" ]]; then
log "Installation failed: ${INSTALL_DIR}/java/projectzomboid.jar not found"
exit 1
fi
# Steam's install metadata; not needed at runtime.
rm --recursive --force "${INSTALL_DIR}/steamapps"
}
main