Add entrypoint script and change user account type to system

This commit is contained in:
mr-vercetti 2022-03-24 23:54:55 +01:00
parent 0ed422e04c
commit 9592e6cedd
2 changed files with 19 additions and 13 deletions

View File

@ -1,4 +1,5 @@
FROM debian:stable-slim FROM debian:stable-slim
LABEL maintainer="mr-vercetti"
# Install dependencies # Install dependencies
RUN dpkg --add-architecture i386 && \ RUN dpkg --add-architecture i386 && \
@ -9,21 +10,22 @@ RUN dpkg --add-architecture i386 && \
locale-gen --no-purge en_US.UTF-8 && \ locale-gen --no-purge en_US.UTF-8 && \
apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* 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 APP_DIR="/app"
ENV STEAMCMD_DIR="${APP_DIR}/Steam/steamcmd" ENV STEAMCMD_DIR="${APP_DIR}/Steam/steamcmd"
ENV SVENCOOP_DIR="${APP_DIR}/svencoop" ENV SERVER_DIR="${APP_DIR}/server"
ENV PUID="1000" ENV GAME_PARAMS="-num_edicts 3072 +sv_lan 1 -port 27015 -console -debug;"
ENV PGID="1000"
# Set up user environment # Set up user environment
RUN groupadd -g ${PGID} abc && \ RUN groupadd -r abc && \
useradd -d ${APP_DIR} -u ${PUID} -g abc abc && \ useradd -d ${APP_DIR} -r -g abc abc && \
mkdir -p ${SVENCOOP_DIR} ${STEAMCMD_DIR} && \ mkdir -p ${SERVER_DIR} ${STEAMCMD_DIR} && \
chown -R abc:abc ${APP_DIR} chown -R abc:abc ${APP_DIR}
ADD --chown=abc:abc --chmod=755 /scripts/start.sh /
USER abc USER abc
WORKDIR ${STEAMCMD_DIR} WORKDIR ${APP_DIR}
# Download and update steamcmd # Download and update steamcmd
RUN wget -qO- http://media.steampowered.com/installer/steamcmd_linux.tar.gz | tar xz -C ${STEAMCMD_DIR} && \ 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 ${STEAMCMD_DIR}/steamcmd.sh +force_install_dir ${STEAMCMD_DIR} +login anonymous +quit
# Download Sven Co-Op server # Download Sven Co-Op server
RUN ${STEAMCMD_DIR}/steamcmd.sh +login anonymous +force_install_dir ${SVENCOOP_DIR} +app_update 276060 validate +quit && \ RUN ${STEAMCMD_DIR}/steamcmd.sh +login anonymous +force_install_dir ${SERVER_DIR} +app_update 276060 validate +quit && \
echo "225840" > ${SVENCOOP_DIR}/steam_appid.txt echo "225840" > ${SERVER_DIR}/steam_appid.txt
# Link steamclient.so to prevent srcds_run errors # Link steamclient.so to prevent srcds_run errors
RUN mkdir -p ${APP_DIR}/.steam/sdk32 && \ 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 ["/start.sh"]
ENTRYPOINT ["/app/svencoop/svends_run"]

5
scripts/start.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "Starting Sven Co-Op server..."
cd ${SERVER_DIR}
${SERVER_DIR}/svends_run ${GAME_PARAMS}