Defer install to first run

This commit is contained in:
paul 2020-08-13 06:24:45 +02:00
parent 598d908514
commit 26e109dd03
2 changed files with 46 additions and 7 deletions

View file

@ -2,12 +2,9 @@ FROM zombi/steam:latest
MAINTAINER MadMaurice <madmaurice@zom.bi>
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"]

42
bin/entrypoint.sh Normal file
View file

@ -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