|
| 1 | +FROM steamcmd/steamcmd AS steambuild |
| 2 | +# REPO_SETUP: Add maintainers |
| 3 | + |
| 4 | +ARG UID=999 |
| 5 | +ARG GID=999 |
| 6 | + |
| 7 | +ENV CONFIG_LOC="/config" |
| 8 | +ENV INSTALL_LOC="/GAME_NAME" |
| 9 | +ENV HOME=${INSTALL_LOC} |
| 10 | +ENV DEBIAN_FRONTEND="noninteractive" |
| 11 | + |
| 12 | +USER root |
| 13 | + |
| 14 | +# REPO_SETUP: Append any packages that your server needs to the |
| 15 | +# REPO_SETUP: `apt install` line. |
| 16 | +RUN apt update && \ |
| 17 | + # Install libsdl, used by steamcmd |
| 18 | + apt install -y --no-install-recommends libsdl2-2.0-0 |
| 19 | + |
| 20 | +# Setup directory structure and user permissions |
| 21 | +RUN mkdir -p $INSTALL_LOC && \ |
| 22 | + groupadd -g $GID GAME_NAME && \ |
| 23 | + useradd -m -s /bin/false -u $UID -g $GID GAME_NAME && \ |
| 24 | + mkdir -p $CONFIG_LOC $INSTALL_LOC && \ |
| 25 | + chown -R GAME_NAME:GAME_NAME $INSTALL_LOC $CONFIG_LOC |
| 26 | + |
| 27 | +USER GAME_NAME |
| 28 | + |
| 29 | +# REPO_SETUP: You might consider installing steam appid 1007 ("+app_update 1007 validate \") |
| 30 | +# REPO_SETUP: alongside your game here if your game needs the steam libraries |
| 31 | +# REPO_SETUP: to appear in the server browser etc. |
| 32 | + |
| 33 | +# REPO_SETUP: If your game is windows only, you *might* be able to run it inside a linux container |
| 34 | +# REPO_SETUP: with wine and xvfb-run. If so, add a "+@sSteamCmdForcePlatformType windows \" |
| 35 | +# REPO_SETUP: line to this steamcmd command, and install xvfb and wine. |
| 36 | +# REPO_SETUP: Alternatively, see https://github.com/FragSoc/steamcmd-wine-xvfb-docker; |
| 37 | +# REPO_SETUP: you can use this as the base image for this template if you want :) |
| 38 | +# REPO_SETUP: (you'll still need that that platform force steamcmd command) |
| 39 | + |
| 40 | +# Install the GAME_NAME server |
| 41 | +# REPO_SETUP: Get the appid of the dedicated server from steamdb or similar |
| 42 | +ARG APPID=<YOUR APPID HERE> |
| 43 | +ARG STEAM_BETA |
| 44 | +RUN steamcmd \ |
| 45 | + +login anonymous \ |
| 46 | + +force_install_dir $INSTALL_LOC \ |
| 47 | + +app_update $APPID $STEAM_BETA validate \ |
| 48 | + +quit && \ |
| 49 | + # REPO_SETUP: you will probably want to symlink the game's default config directory |
| 50 | + # REPO_SETUP: to $CONFIG_LOC here |
| 51 | + |
| 52 | +# I/O |
| 53 | +VOLUME $CONFIG_LOC |
| 54 | +# REPO_SETUP: Add any ports you might need. Don't forget to append with /udp if necessary |
| 55 | + |
| 56 | +# Expose and run |
| 57 | +USER GAME_NAME |
| 58 | +WORKDIR $INSTALL_LOC |
| 59 | +# REPO_SETUP: Add an entrypoint for the game |
0 commit comments