more like the csgo docker image

This commit is contained in:
Djeeberjr 2021-11-01 15:53:00 +01:00
parent c3494df3b5
commit 3f4d62daac
4 changed files with 25 additions and 29 deletions

View File

@ -1,7 +1,6 @@
FROM cm2network/steamcmd:latest
RUN mkdir -p /home/steam/server
COPY start.sh /home/steam/start.sh
VOLUME "/home/steam/server"
WORKDIR /home/steam/
ENTRYPOINT /home/steam/start.sh

View File

@ -4,9 +4,13 @@ Left 4 dead 2 server.
- 27015
- 27015/udp
# Volumes
You can create a volume at `/home/steam/server` to not redownload the game every time you make a change at the docker-compose file.
# Configuration
The `server.cfg` gets created on the fly and gets filled with the enviroment variable starting with `CVAR_`.
You can set ANY conVar you want simply by prefixing the enviroment with `CVAR_`.
So for example to set the RCON password set the enviroment variable `CVAR_RCON_PASSWORD=password123`.
Try to avoid variables with the word `CVAR_` and avoid `=` in it.

View File

@ -10,9 +10,18 @@ services:
- CVAR_SV_CONSISTENCY=1
- CAVR_SV_VOICEENABLE=1
- CVAR_MP_DISABLE_AUTOKICK=1
volumes:
- ./motd.txt:/motd.txt:ro
- ./host:txt:/host.txt:ro
- "MOTD_FILE_CONTENT=Put your MODT here. \n
Multiline is also supported."
- "HOST_FILE_CONTENT=Same with the host file \n
lalalalal"
ports:
- 27015:27015
- 27015:27015/udp
volumes:
- l4d2_game:/home/steam/server
stdin_open: true
tty: true
volumes:
l4d2_game:
name: l4d2_game

View File

@ -2,30 +2,14 @@
set -e
echo "### Installing / Updateing l4d2 ###"
/home/steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir "$HOME/server" +app_update 222860 validate +quit
/home/steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir $HOME/server +app_update 222860 validate +quit
echo -n "$MOTD_FILE_CONTENT" > "$HOME/server/left4dead2/motd.txt"
echo "### Creating config ###"
echo -n "$HOST_FILE_CONTENT" > "$HOME/server/left4dead2/host.txt"
env | awk -F "=" '/^CVAR_/ {sub("CVAR_","",$1); print tolower($1),($2 ~ /^[0-9]+$/)?$2:"\""$2"\""}' > $HOME/server/left4dead2/cfg/server.cfg
env | awk -F "=" '/^CVAR_/ {sub("CVAR_","",$1); print tolower($1),($2 ~ /^[0-9]+$/)?$2:"\""$2"\""}' > /home/steam/server/left4dead2/cfg/server.cfg
echo "### Using follwing config: "
cat $HOME/server/left4dead2/cfg/server.cfg
echo "###"
cat /home/steam/server/left4dead2/cfg/server.cfg
echo "### Linking host and motd file ### "
if [[ -f "/motd.txt" ]]; then
rm $HOME/server/left4dead2/motd.txt
ln -sf /motd.txt $HOME/server/left4dead2/motd.txt
fi
if [[ -f "/host.txt" ]]; then
rm $HOME/server/left4dead2/host.txt
ln -sf /host.txt $HOME/server/left4dead2/host.txt
fi
echo "### Starting l4d2 ###"
$HOME/server/srcds_run -console -game left4dead2 +maxplayers 16 -maxclients 16 -ip 0.0.0.0 +map c1m1_hotel
"$HOME/server/srcds_run" -console -game left4dead2 +maxplayers 16 -maxclients 16 -ip 0.0.0.0