From 05574415dbacf8880cdebe3386a06da60ffd50c6 Mon Sep 17 00:00:00 2001 From: Dave Jansen Date: Fri, 22 Feb 2019 18:02:29 +0900 Subject: [PATCH] Dramatically reduced steps, pre-adding expected game folder, overall cleanup, etc. --- Dockerfile | 58 +++++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 90f4369..71eb064 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,30 @@ FROM ubuntu:18.04 -LABEL Name=docker-steamcmd Version=1.0.0 Maintainer="Dave Jansen - Pretty Basic" +LABEL Name=docker-steamcmd Version=1.5.0 Maintainer="Dave Jansen - Pretty Basic" -## Ports -# Query Port cannot be between 27020 and 27050 due to Steam using those ports. -ENV PORT_STEAM=27015 - -## Other Settings -ENV STEAMCMD_URL="https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" -ENV USER_STEAM_ID=1000 -ENV DIR_STEAMCMD=/opt/steamcmd - -# For debugging purposes only -ENV DEBUGGER= +## Defaults +# Note: Query Port cannot be between 27020 and 27050 due to Steam using those ports. +ENV \ + PORT_STEAM=27015 \ + STEAMCMD_URL="https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" \ + USER_STEAM_ID=1000 \ + DIR_STEAMCMD=/opt/steamcmd \ + DIR_GAME=/opt/game \ + DIR_USER=/opt/user \ + DIR_APP=/opt/app # Start by updating and installing the required packages RUN set -ex; \ apt-get -y update; \ apt-get -y upgrade; \ - apt-get install -y curl lib32gcc1; + apt-get install -y curl lib32gcc1; \ + rm -rf /var/lib/{apt,dpkg,cache,log}/; -# Adjust open file limitations -- This is required for certain games, so let's set it by default -RUN ulimit -n 100000; - -# Create a user and usergroup for Steam -RUN set -ex; \ +# Create a user and usergroup for Steam, and adjust open file limitations. +# This is required for certain games, so let's set it by default +RUN \ + ulimit -n 100000; \ + set -ex; \ addgroup \ -gid ${USER_STEAM_ID} \ steam; \ @@ -34,26 +34,22 @@ RUN set -ex; \ --gecos "" \ --gid ${USER_STEAM_ID} \ --uid ${USER_STEAM_ID} \ - steam; + steam; \ + mkdir -p ${DIR_STEAMCMD} ${DIR_GAME} ${DIR_USER} ${DIR_APP}; \ + cd $DIR_STEAMCMD; \ + curl -sqL ${STEAMCMD_URL} | tar zxfv -; \ + chown -R steam:steam ${DIR_STEAMCMD} ${DIR_GAME} ${DIR_USER} ${DIR_APP}; -# Create the directory SteamCMD will live in, and set its ownership -RUN mkdir -p $DIR_STEAMCMD -RUN chown steam:steam $DIR_STEAMCMD - -WORKDIR $DIR_STEAMCMD - -# Make sure everything is run as the Steam user +# Make sure everything is run as the Steam user from the steam dir USER steam - -# Download & unpack SteamCMD -RUN curl -sqL ${STEAMCMD_URL} | tar zxfv - +WORKDIR ${DIR_STEAMCMD} # Announce the default Steam ports -# Note: You should open game-specific ports, too. +# Note: You should open game-specific port too. EXPOSE ${PORT_STEAM}/udp # Optional: Initial run with anonymous login # This should stay disabled when using Docker Hub to auto-build, for example -#RUN [ "./steamcmd.sh", "+@NoPromptForPassword 1", "+login anonymous", "+quit" ] +# RUN [ "./steamcmd.sh", "+@NoPromptForPassword 1", "+login anonymous", "+quit" ] ENTRYPOINT [ "./steamcmd.sh" ]