Install, patch config files, and run.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jack Hadrill 2022-07-31 19:10:28 +01:00
parent f645b11ddc
commit 049c5df9e3
3 changed files with 75 additions and 2 deletions

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM steamcmd/steamcmd:ubuntu
RUN apt-get update && apt-get install -y libcurl4 && apt-get clean
WORKDIR /game
COPY start.sh /start.sh
ENTRYPOINT [ "bash" ]
CMD [ "/start.sh" ]

View File

@ -1,3 +1,37 @@
# KillingFloor2Docker # Killing Floor 2 - Docker
Dockerised Killing Floor 2 server. Dockerised Killing Floor 2 server.
Run with the following environment variables:
```
SERVER_NAME (default: KillingFloor2)
MOTD (default: KillingFloor)
WEBSITE_LINK (default: none)
PASSWORD (default: none)
ADMIN_PASSWORD (default: VerySecurePassword)
WEB_PASSWORD (default: none)
MAX_PLAYERS (default: 12)
GAME_DIFFICULTY (default: 1)
```
Example `docker-compose.yml` file:
```yml
version: '3'
services:
killingfloor2:
image: docker.nexus.jacknet.io/jackhadrill/games/killingfloor2:latest
ports:
- '7777:7777/udp'
- '27015:27015/tcp'
- '8080:8080/tcp'
environment:
SERVER_NAME: 'JackNet'
MOTD: 'Welcome to the JackNet KF2 server.'
WEBSITE_LINK: 'https://jacknet.io/'
PASSWORD: password123
ADMIN_PASSWORD: password123
```
Mount `/game` if you want to persist the server files. Else, it will download on each launch.

30
start.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/bash
ServerName="${SERVER_NAME:-KillingFloor2}"
Motd="${MOTD:-KillingFloor2}"
WebsiteLink="${WEBSITE_LINK:-}"
Password="${PASSWORD:-}"
AdminPassword="${ADMIN_PASSWORD:-VerySecurePassword}"
WebPassword="${WEB_PASSWORD:-}"
MaxPlayers="${MAX_PLAYERS:-12}"
GameDifficulty="${GAME_DIFFICULTY:-1}"
# Update server.
steamcmd +login anonymous +force_install_dir /game +app_update 232130 validate +exit
# Generate default config.
/game/Binaries/Win64/KFGameSteamServer.bin.x86_64 exit
# Patch config files.
sed -i "s/GamePassword=.*/GamePassword=${Password}/g" /game/KFGame/Config/LinuxServer-KFGame.ini
sed -i "s/AdminPassword=.*/AdminPassword=${AdminPassword}/g" /game/KFGame/Config/LinuxServer-KFGame.ini
sed -i "s/MaxPlayers=.*/MaxPlayers=${MaxPlayers}/g" /game/KFGame/Config/LinuxServer-KFGame.ini
sed -i "s/GameDifficulty=.*/GameDifficulty=${GameDifficulty}/g" /game/KFGame/Config/LinuxServer-KFGame.ini
sed -i "s/ServerMOTD=.*/ServerMOTD=${Motd}/g" /game/KFGame/Config/LinuxServer-KFGame.ini
sed -i "s/WebsiteLink=.*/WebsiteLink=${WebsiteLink}/g" /game/KFGame/Config/LinuxServer-KFGame.ini
sed -i "s/ServerName=.*/ServerName=${ServerName}/g" /game/KFGame/Config/LinuxServer-KFGame.ini
sed -i "s/ShortName=.*/ShortName=${ServerName}/g" /game/KFGame/Config/LinuxServer-KFGame.ini
sed -i "s/bEnabled=.*/bEnabled=true/g" /game/KFGame/Config/KFWeb.ini
# Run
/game/Binaries/Win64/KFGameSteamServer.bin.x86_64