diff --git a/Dockerfile b/Dockerfile index 6d7040b..4ef1f7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,9 @@ FROM zombi/steam:latest MAINTAINER MadMaurice EXPOSE 27015/udp -RUN /opt/steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/steam/insurgency +app_update 237410 validate +quit &&\ - chown -R steam /home/steam/insurgency - -WORKDIR /home/steam/insurgency - +ADD bin/entrypoint.sh /entrypoint.sh +RUN chmod +xr /entrypoint.sh USER steam -ENTRYPOINT ["./srcds_run", "-game", "insurgency"] -CMD ["-console", "+mapgroup", "mg_active", "+map", "ministry", "+maxplayers", "8", "+mapcyclefile","mapcycle_cooperative.txt"] +ENTRYPOINT ["/entrypoint.sh"] +CMD ["+mapgroup", "mg_active", "+map", "ministry", "+maxplayers", "8", "+mapcyclefile", "mapcycle_cooperative.txt"] diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh new file mode 100644 index 0000000..4403065 --- /dev/null +++ b/bin/entrypoint.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# what are we trying to install? +game_nm=insurgency +game_id=237410 + +# install game to this directory +installdir=/home/steam/games/$game_nm + +# if path does not exist, create it +mkdir -p $installdir + +if [ -w $installdir ] # can we write into the directory? +then + # Install or update the game in /home/steam/games/[game name] + /opt/steamcmd/steamcmd.sh \ + +login anonymous \ + +force_install_dir $installdir \ + +app_update $game_id validate \ + +quit +else + # install dir maybe mounted read-only, simply + # skip installing/updating and inform the user. + echo "Skipped game installation." +fi + +# run the next commands from the installdir +cd $installdir + +# is the game launcher not executable? +if [ ! -x ./srcds_run ] +then + # we cant run the game then. + echo "game launcher not found, installed incorrectly?" + exit 1 +fi + +# launch the game! +exec ./srcds_run \ + -game $game_nm \ + -console \ + $@ # append all remaining parameters \ No newline at end of file