Add tf2 server files

This commit is contained in:
Christine Dodrill 2015-07-27 00:40:01 +00:00
parent 97a79f4eb3
commit 1d6e9c7a69
5 changed files with 52 additions and 0 deletions

23
games/tf2/Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM ubuntu:12.04
MAINTAINER Max Gonzih <gonzih at gmail dot com>
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get -y install lib32gcc1 lib32z1 lib32ncurses5 lib32bz2-1.0 lib32asound2 wget
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN adduser --gecos "" tf2
USER tf2
ENV HOME /home/tf2
ENV SERVER $HOME/hlserver
RUN mkdir $SERVER
RUN wget -O - http://media.steampowered.com/client/steamcmd_linux.tar.gz | tar -C $SERVER -xvz
ADD ./tf2_ds.txt $SERVER/tf2_ds.txt
ADD ./update.sh $SERVER/update.sh
ADD ./tf.sh $SERVER/tf.sh
RUN $SERVER/update.sh
EXPOSE 27015/udp
ENTRYPOINT ["/home/tf2/hlserver/tf.sh"]
CMD ["+sv_pure", "1", "+mapcycle", "mapcycle_quickplay_payload.txt", "+map", "pl_badwater", "+maxplayers", "24"]

19
games/tf2/README.md Normal file
View File

@ -0,0 +1,19 @@
## Team Fortress 2 + Docker
### Details:
By default image is build with enabled autoupdate feature (take a look at `tf.sh` file).
You can create new Dockerfile based on that image (FROM tf2) and customize it with plugins, configs, CMD and ENTRYPOINT instructions.
```shell
# Build image and tag it as tf2
docker build -t tf2 github.com/Gonzih/docker-tf2-server
# Run image with default options (CMD in Dockerfile)
docker run -d -p 27015:27015/udp tf2
# Run image with custom options
docker run -d -p 27015:27015/udp tf2 +sv_pure 2 +map ctf_2fort.bsp +maxplayers 32
# Run image with custom config
docker run -d -p 27015:27015/udp -v ~/server.cfg:/home/tf2/hlserver/tf2/tf/cfg/server.cfg:ro tf2
```

3
games/tf2/tf.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
cd $HOME/hlserver
tf2/srcds_run -game tf -autoupdate -steam_dir ~/hlserver -steamcmd_script ~/hlserver/tf2_ds.txt $@

4
games/tf2/tf2_ds.txt Normal file
View File

@ -0,0 +1,4 @@
login anonymous
force_install_dir ./tf2
app_update 232250
quit

3
games/tf2/update.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
cd $HOME/hlserver
./steamcmd.sh +runscript tf2_ds.txt