commit 6e09887eacfe8804d76475fed59073a0b66b8ea9 Author: Paul Scheunemann Date: Thu Apr 13 10:57:41 2017 +0200 truncate history diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..54a6b61 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM zombi/steam-base +MAINTAINER MadMaurice , Paul +EXPOSE 27015/udp + +ADD bin/entrypoint.sh /entrypoint.sh +RUN chmod +xr /entrypoint.sh +USER steam + +ENTRYPOINT ["./entrypoint.sh"] +CMD ["+maxplayers", "16", "+hostname", "Zom.bi TTT", "+gamemode", "terrortown", "+map", "gm_construct"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..39e8a19 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +## steam-gmod +steam-gmod is the base image for an "Gary's Mod" server, combined with a CounterStrike:Source server for assets. + +### Data locations + * maps in /home/steam/gmod/garrysmod/maps + * server configuration in /home/steam/gmod/garrysmod/cfg/server.cfg + * bans in /home/steam/gmod/garrysmod/cfg/banned_user.cfg + * motd in /home/steam/gmod/garrysmod/addons/ulx/ulx_motd.txt + * addon data in /home/steam/gmod/garrysmod/data/ + +Data for optional mods + * ttt_damagelogs data in /home/steam/gmod/garrysmod/addons/ttt_damagelogs + * damage logs database in /home/steam/gmod/garrysmod/sv.db + +### Building steam-gmod + +first build the `steam-base` image. + +``` +docker build -t zombi/steam-gmod . +``` + +### Running steam-gmod + +Please note that you probably want to add a workshop collection, which +can be generated in steam. It is a good idea to put mods like Wiremod, +Ulib, ULX etc. there, and extend with some maps and custom props. + +``` +docker run -d \ + --name gmod-1 \ + -p 27015:27015/udp \ + -p 27015:27015 \ + -v /data/steam-games/:/home/steam/games/ \ + -v /data/gmod/maps/:/home/steam/games/garrysmod/garrysmod/maps/ \ + -v /data/gmod/server.cfg:/home/steam/games/garrysmod/garrysmod/cfg/server.cfg \ + -v /data/gmod/motd.txt:/home/steam/games/garrysmod/garrysmod/addons/ulx/ulx_motd.txt \ + -v /data/gmod/bans.cfg:/home/steam/games/garrysmod/garrysmod/cfg/banned_user.cfg \ + -v /data/gmod/addons/tttdamagelogs:/home/steam/games/garrysmod/garrysmod/addons/tttdamagelogs/ \ + -v /data/gmod/data/:/home/steam/gmod/garrysmod/data/ \ + zombi/steam-gmod +hostname "Zom.bi TTT" \ + -authkey SUPERLONGAUTHKEYAAAAAAAAA23880ED \ + +host_workshop_collection 337948370 \ + +gamemode terrortown \ + +maxplayers 16 \ + +map ttt_dolls +``` + +to start up a simple server to terrorize some terrorists. + +If you want to start up a Sandbox, you can do that too: + +``` +docker run -d \ + --name gmod-1 \ + -p 27015:27015/udp \ + -p 27015:27015 \ + -v /data/steam-games/:/home/steam/games/ \ + -v /data/gmod/server.cfg:/home/steam/games/garrysmod/garrysmod/cfg/server.cfg \ + -v /data/gmod/motd.txt:/home/steam/games/garrysmod/garrysmod/addons/ulx/ulx_motd.txt \ + -v /data/gmod/bans.cfg:/home/steam/games/garrysmod/garrysmod/cfg/banned_user.cfg \ + -v /data/gmod/data/:/home/steam/games/garrysmod/garrysmod/data/ \ + zombi/steam-gmod +hostname "Zom.bi Sandbox" \ + +host_workshop_collection 337948370 \ + +gamemode sandbox \ + +maxplayers 16 \ + +map gm_construct +``` + +### Data locations + * game data in /home/steam/games + * maps in /home/steam/games/garrysmod/garrysmod/maps + * server configuration in /home/steam/games/garrysmod/garrysmod/cfg/server.cfg + * bans in /home/steam/games/garrysmod/garrysmod/cfg/banned_user.cfg + * motd in /home/steam/games/garrysmod/garrysmod/addons/ulx/ulx_motd.txt + * addon data in /home/steam/games/garrysmod/garrysmod/data/ + +Data for optional mods + * ttt_damagelogs data in /home/steam/gmod/garrysmod/addons/ttt_damagelogs + +protip: you can simplify deployment by using named volumes. diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh new file mode 100644 index 0000000..25b58db --- /dev/null +++ b/bin/entrypoint.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# what are we trying to install? +game_nm=garrysmod +game_id=4020 + +# 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 + + # ---------------------------------------------------------- + # GMOD SPECIFIC INSTALLATIONS + # TODO: add mount cfg maybe? + +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 diff --git a/mount.cfg b/mount.cfg new file mode 100755 index 0000000..d9befde --- /dev/null +++ b/mount.cfg @@ -0,0 +1,13 @@ + +// +// Use this file to mount additional paths to the filesystem +// DO NOT add a slash to the end of the filename +// + +"mountcfg" +{ + "cstrike" "/home/steam/css/cstrike" + // "tf" "C:\mytf2server\tf" +} + +