From 3c9315d3c458d41ccdcf8ede42e3471c6cc02b5c Mon Sep 17 00:00:00 2001 From: Miguel Jimenez Date: Tue, 23 Jan 2024 15:13:53 -0800 Subject: [PATCH 1/2] Setting up palworld volume correct permissions --- Dockerfile | 7 +++++++ servermanager.sh | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2efdf8f..fce769c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,6 +40,11 @@ ENV TIMEZONE=Europe/Berlin \ BACKUP_ENABLED=true \ BACKUP_CRON_EXPRESSION="0 * * * *" +USER root + +RUN mkdir /palworld +RUN chown steam:steam /palworld + VOLUME [ "/palworld" ] EXPOSE 8211/udp @@ -48,4 +53,6 @@ EXPOSE 25575/tcp ADD --chmod=777 servermanager.sh /servermanager.sh ADD --chmod=777 backupmanager.sh /backupmanager.sh +USER steam + CMD ["/servermanager.sh"] diff --git a/servermanager.sh b/servermanager.sh index 4632109..44676ec 100644 --- a/servermanager.sh +++ b/servermanager.sh @@ -5,13 +5,13 @@ GAME_PATH="/palworld" function installServer() { # force a fresh install of all echo ">>> Doing a fresh install of the gameserver" - /home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit + /home/steam/steamcmd/steamcmd.sh +force_install_dir "$GAME_PATH" +login anonymous +app_update 2394010 validate +quit } function updateServer() { # force an update and validation echo ">>> Doing an update of the gameserver" - /home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit + /home/steam/steamcmd/steamcmd.sh +force_install_dir "$GAME_PATH" +login anonymous +app_update 2394010 validate +quit } function startServer() { @@ -89,7 +89,7 @@ function startMain() { /usr/local/bin/supercronic cronlist & fi # Check if server is installed, if not try again - if [ ! -f "/palworld/PalServer.sh" ]; then + if [ ! -f "$GAME_PATH/PalServer.sh" ]; then installServer fi if [ $ALWAYS_UPDATE_ON_START == "true" ]; then From 172cd91a1c9b738d37d4ec1302a97acfa0209859 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt <2270806+jammsen@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:09:44 +0100 Subject: [PATCH 2/2] Restructured Dockerfile, less context-switching, less layers needed, improved security and formating, tested also backups --- Dockerfile | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d1d62f..b27487f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ LABEL org.opencontainers.image.authors="Sebastian Schmidt" LABEL org.opencontainers.image.source="https://github.com/jammsen/docker-palworld-dedicated-server" RUN apt-get update \ - && apt-get install -y --no-install-recommends procps xdg-user-dirs \ + && apt-get install -y --no-install-recommends --no-install-suggests procps xdg-user-dirs \ && apt-get clean \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* @@ -15,10 +15,21 @@ ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0. SUPERCRONIC_SHA1SUM=cd48d45c4b10f3f0bfdd3a57d054cd05ac96812b RUN curl -fsSLO "$SUPERCRONIC_URL" \ - && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ - && chmod +x "$SUPERCRONIC" \ - && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ - && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic + && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ + && chmod +x "$SUPERCRONIC" \ + && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ + && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic + +ADD --chown=steam:steam --chmod=755 servermanager.sh /servermanager.sh +ADD --chown=steam:steam --chmod=755 backupmanager.sh /backupmanager.sh + +EXPOSE 8211/udp +EXPOSE 25575/tcp + +RUN mkdir /palworld \ + && chown steam:steam /palworld + +VOLUME [ "/palworld" ] USER steam @@ -40,19 +51,4 @@ ENV DEBIAN_FRONTEND=noninteractive \ BACKUP_ENABLED=true \ BACKUP_CRON_EXPRESSION="0 * * * *" -USER root - -RUN mkdir /palworld -RUN chown steam:steam /palworld - -VOLUME [ "/palworld" ] - -EXPOSE 8211/udp -EXPOSE 25575/tcp - -ADD --chmod=777 servermanager.sh /servermanager.sh -ADD --chmod=777 backupmanager.sh /backupmanager.sh - -USER steam - CMD ["/servermanager.sh"]