From 9592e6ceddcb6ef99b7602dd294471f29e3af94b Mon Sep 17 00:00:00 2001 From: mr-vercetti <87.milewski@gmail.com> Date: Thu, 24 Mar 2022 23:54:55 +0100 Subject: [PATCH] Add entrypoint script and change user account type to system --- Dockerfile | 27 ++++++++++++++------------- scripts/start.sh | 5 +++++ 2 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 scripts/start.sh diff --git a/Dockerfile b/Dockerfile index eae6bd4..fc121d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM debian:stable-slim +LABEL maintainer="mr-vercetti" # Install dependencies RUN dpkg --add-architecture i386 && \ @@ -9,21 +10,22 @@ RUN dpkg --add-architecture i386 && \ locale-gen --no-purge en_US.UTF-8 && \ apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* -ENV LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8" +ENV LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 ENV APP_DIR="/app" ENV STEAMCMD_DIR="${APP_DIR}/Steam/steamcmd" -ENV SVENCOOP_DIR="${APP_DIR}/svencoop" -ENV PUID="1000" -ENV PGID="1000" +ENV SERVER_DIR="${APP_DIR}/server" +ENV GAME_PARAMS="-num_edicts 3072 +sv_lan 1 -port 27015 -console -debug;" # Set up user environment -RUN groupadd -g ${PGID} abc && \ - useradd -d ${APP_DIR} -u ${PUID} -g abc abc && \ - mkdir -p ${SVENCOOP_DIR} ${STEAMCMD_DIR} && \ +RUN groupadd -r abc && \ + useradd -d ${APP_DIR} -r -g abc abc && \ + mkdir -p ${SERVER_DIR} ${STEAMCMD_DIR} && \ chown -R abc:abc ${APP_DIR} +ADD --chown=abc:abc --chmod=755 /scripts/start.sh / + USER abc -WORKDIR ${STEAMCMD_DIR} +WORKDIR ${APP_DIR} # Download and update steamcmd RUN wget -qO- http://media.steampowered.com/installer/steamcmd_linux.tar.gz | tar xz -C ${STEAMCMD_DIR} && \ @@ -31,12 +33,11 @@ RUN wget -qO- http://media.steampowered.com/installer/steamcmd_linux.tar.gz | ta ${STEAMCMD_DIR}/steamcmd.sh +force_install_dir ${STEAMCMD_DIR} +login anonymous +quit # Download Sven Co-Op server -RUN ${STEAMCMD_DIR}/steamcmd.sh +login anonymous +force_install_dir ${SVENCOOP_DIR} +app_update 276060 validate +quit && \ - echo "225840" > ${SVENCOOP_DIR}/steam_appid.txt +RUN ${STEAMCMD_DIR}/steamcmd.sh +login anonymous +force_install_dir ${SERVER_DIR} +app_update 276060 validate +quit && \ + echo "225840" > ${SERVER_DIR}/steam_appid.txt # Link steamclient.so to prevent srcds_run errors RUN mkdir -p ${APP_DIR}/.steam/sdk32 && \ - ln -s ${SVENCOOP_DIR}/steamclient.so ${APP_DIR}/.steam/sdk32/steamclient.so + ln -s ${SERVER_DIR}/steamclient.so ${APP_DIR}/.steam/sdk32/steamclient.so -WORKDIR ${SVENCOOP_DIR} -ENTRYPOINT ["/app/svencoop/svends_run"] \ No newline at end of file +ENTRYPOINT ["/start.sh"] \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh new file mode 100644 index 0000000..265cc6e --- /dev/null +++ b/scripts/start.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "Starting Sven Co-Op server..." +cd ${SERVER_DIR} +${SERVER_DIR}/svends_run ${GAME_PARAMS}