diff --git a/Dockerfile b/Dockerfile index d659135..57931fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,10 @@ +FROM mrvercetti/steamcmd as builder + +# Download Sven Co-Op server +RUN ${STEAMCMD_DIR}/steamcmd.sh +login anonymous +force_install_dir ${OUTPUT_DIR} +app_update 276060 validate +quit && \ + echo "225840" > ${OUTPUT_DIR}/steam_appid.txt + +# Fresh start FROM debian:stable-slim LABEL maintainer="mr-vercetti" @@ -10,10 +17,10 @@ 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/* +# General variables ENV LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 -ENV APP_DIR="/app" -ENV STEAMCMD_DIR="${APP_DIR}/Steam/steamcmd" -ENV SERVER_DIR="${APP_DIR}/server" +ENV SERVER_DIR="/svencoop-server" +ENV OUTPUT_DIR="/output" # Startup variables ENV GAME_PARAMS="-num_edicts 3072 +sv_lan 1 -port 27015 -console -debug;" ENV GAME_NAME="" @@ -21,26 +28,19 @@ ENV GAME_PASSWORD="" # Set up user environment 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 / + useradd -d ${SERVER_DIR} -r -g abc abc && \ + mkdir -p ${SERVER_DIR} && \ + chown -R abc:abc ${SERVER_DIR} USER abc -WORKDIR ${APP_DIR} +WORKDIR ${SERVER_DIR} -# Download and update steamcmd -RUN wget -qO- http://media.steampowered.com/installer/steamcmd_linux.tar.gz | tar xz -C ${STEAMCMD_DIR} && \ - chmod +x ${STEAMCMD_DIR}/steamcmd.sh && \ - ${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 ${SERVER_DIR} +app_update 276060 validate +quit && \ - echo "225840" > ${SERVER_DIR}/steam_appid.txt +# Copy needed files +COPY --chown=abc:abc --chmod=755 /scripts/start.sh / +COPY --chown=abc:abc --from=builder ${OUTPUT_DIR} ${SERVER_DIR} # Link steamclient.so to prevent srcds_run errors -RUN mkdir -p ${APP_DIR}/.steam/sdk32 && \ - ln -s ${SERVER_DIR}/steamclient.so ${APP_DIR}/.steam/sdk32/steamclient.so +RUN mkdir -p ${SERVER_DIR}/.steam/sdk32 && \ + ln -s ${SERVER_DIR}/steamclient.so ${SERVER_DIR}/.steam/sdk32/steamclient.so -ENTRYPOINT ["/start.sh"] \ No newline at end of file +ENTRYPOINT ["/start.sh"]