commit 029ded737793402afc478c6c917c15abdb4e215e Author: Niklas Date: Mon Apr 12 15:54:25 2021 +0200 initial commit diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..0a2007b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,9 @@ +kind: pipeline +name: default + +steps: +- name: docker + image: plugins/docker + settings: + repo: docker.kapelle.org/l4d2 + registry: docker.kapelle.org diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d5ca22 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +* +!.gitignore +!Dockerfile +!docker-compose.yml +!start.sh +!README.md +!.drone.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..360dd61 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM cm2network/steamcmd:latest + +COPY start.sh /home/steam/start.sh + +WORKDIR /home/steam/ + +ENTRYPOINT /home/steam/start.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..bf0504a --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +Left 4 dead 2 server. + +# Ports +- 27015 +- 27015/udp + +# Configuration + +The `server.cfg` gets created on the fly and gets filled with the enviroment variable starting 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. + +A list of available cvars can be found [here](https://developer.valvesoftware.com/wiki/List_of_L4D2_Cvars). diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0184f48 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: "3" + +services: + l4d2: + build: . + environment: + - CVAR_HOSTNAME=My left 4 dead server + - CVAR_RCON_PASSWORD=password123 + - CVAR_MP_DISABLE_AUTOKICK=1 diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..8fa58d9 --- /dev/null +++ b/start.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +echo "### Installing / Updateing l4d2 ###" + +/home/steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir $HOME/server +app_update 222860 validate +quit + +echo "### Creating config ###" + +cd $HOME/server + +env | awk -F "=" '/^CVAR_/ {sub("CVAR_","",$1); print tolower($1),($2 ~ /^[0-9]+$/)?$2:"\""$2"\""}' > docker_server.cfg + +echo "### Starting l4d2 ###" + +$HOME/server/srcds_run -console -game left4dead2 +maxplayers 16 -maxclients 16 +map c1m1_hotel +exec docker_server.cfg