Compare commits
86 Commits
Author | SHA1 | Date | |
---|---|---|---|
662735613a | |||
2179a74156
|
|||
a0438fb352
|
|||
124cc75a92
|
|||
f596f40e33
|
|||
364fa60958
|
|||
f9b39be6ea
|
|||
24aeb8cd48
|
|||
d73fd2b929
|
|||
2b8ac05860
|
|||
13103cb707
|
|||
0581995a64
|
|||
a0a00c890b
|
|||
82145dfd51
|
|||
ec24d2b482
|
|||
a9d3c77c74
|
|||
eed75485e4
|
|||
2f56450a11
|
|||
84f6c7bb8b
|
|||
1db1f0e449
|
|||
cdf5996a67
|
|||
01f5fcda06
|
|||
b3f9cb4842
|
|||
9d1dacb945
|
|||
6ba7468dd4
|
|||
3b192e28bc
|
|||
7ca7819dc0
|
|||
0caa74af9a
|
|||
24879524a6
|
|||
35fc6ee142
|
|||
0bd1533ef6
|
|||
e4aa81e92a
|
|||
131b462758
|
|||
297455987c
|
|||
e95ce85316
|
|||
47458f163f
|
|||
75c287c7bd
|
|||
47e19ffa0f
|
|||
23c470fecf
|
|||
a9c4531631
|
|||
a22d360486
|
|||
17db75f9f1
|
|||
05ea38dd93
|
|||
4a0251f92c
|
|||
b87b184d2b | |||
ae0d4cfa5e | |||
949344ffce | |||
17426d6d06 | |||
3eeaa9dbae | |||
c940174895 | |||
fda697da39 | |||
b31652b3a0 | |||
defbab638b | |||
4adf363774 | |||
6122efa919 | |||
3cb1b2316a | |||
bdb8af76a9 | |||
5be4644a99 | |||
7b89a10aed | |||
502950a082 | |||
c9ace2e467 | |||
327a799379 | |||
f703e6d0f4 | |||
e9a9a4bd80 | |||
cc13e95675 | |||
1d98a05322 | |||
413056a031 | |||
82f2c4d9ad | |||
b84a7d2997 | |||
45bb4ee3df | |||
1e9bedbdfe | |||
08f376a341 | |||
30ce73c0a0 | |||
4d64fe3d3f | |||
628d654703 | |||
ddfd6313fa | |||
c9e15ddb1c | |||
6900edf57f | |||
58d25411d5 | |||
567da1bd10 | |||
00f3c453af | |||
8d89ec077e | |||
bf873f21f3 | |||
3d7e698bc5 | |||
a29620dd5a | |||
8f13b8850d |
42
Dockerfile
42
Dockerfile
@@ -1,36 +1,42 @@
|
|||||||
FROM ubuntu
|
FROM ich777/winehq-baseimage
|
||||||
|
|
||||||
MAINTAINER ich777
|
LABEL org.opencontainers.image.authors="admin@minenet.at"
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/ich777/docker-steamcmd-server"
|
||||||
|
|
||||||
RUN apt-get update
|
RUN dpkg --add-architecture i386 && \
|
||||||
RUN apt-get -y install lib32gcc1 wget
|
apt-get update && \
|
||||||
|
apt-get -y install --no-install-recommends lib32gcc-s1 screen xvfb winbind && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN wget -O /tmp/gotty.tar.gz https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz && \
|
||||||
|
tar -C /usr/bin/ -xvf /tmp/gotty.tar.gz && \
|
||||||
|
rm -rf /tmp/gotty.tar.gz
|
||||||
|
|
||||||
ENV DATA_DIR="/serverdata"
|
ENV DATA_DIR="/serverdata"
|
||||||
ENV STEAMCMD_DIR="${DATA_DIR}/steamcmd"
|
ENV STEAMCMD_DIR="${DATA_DIR}/steamcmd"
|
||||||
ENV SERVER_DIR="${DATA_DIR}/serverfiles"
|
ENV SERVER_DIR="${DATA_DIR}/serverfiles"
|
||||||
ENV GAME_ID="template"
|
ENV GAME_ID="template"
|
||||||
ENV GAME_NAME="template"
|
ENV GAME_PARAMS=""
|
||||||
ENV GAME_PARAMS="template"
|
|
||||||
ENV GAME_PORT=27015
|
|
||||||
ENV VALIDATE=""
|
ENV VALIDATE=""
|
||||||
|
ENV ENABLE_WEBCONSOLE="true"
|
||||||
|
ENV GOTTY_PARAMS="-w --title-format Wreckfest"
|
||||||
|
ENV UMASK=000
|
||||||
ENV UID=99
|
ENV UID=99
|
||||||
ENV GID=100
|
ENV GID=100
|
||||||
ENV USERNAME=""
|
ENV USERNAME=""
|
||||||
ENV PASSWRD=""
|
ENV PASSWRD=""
|
||||||
|
ENV USER="steam"
|
||||||
|
ENV DATA_PERM=770
|
||||||
|
|
||||||
RUN mkdir $DATA_DIR
|
RUN mkdir $DATA_DIR && \
|
||||||
RUN mkdir $STEAMCMD_DIR
|
mkdir $STEAMCMD_DIR && \
|
||||||
RUN mkdir $SERVER_DIR
|
mkdir $SERVER_DIR && \
|
||||||
RUN useradd -d $DATA_DIR -s /bin/bash --uid $UID --gid $GID steam
|
useradd -d $DATA_DIR -s /bin/bash $USER && \
|
||||||
RUN chown -R steam $DATA_DIR
|
chown -R $USER $DATA_DIR && \
|
||||||
|
ulimit -n 2048
|
||||||
RUN ulimit -n 2048
|
|
||||||
|
|
||||||
ADD /scripts/ /opt/scripts/
|
ADD /scripts/ /opt/scripts/
|
||||||
RUN chmod -R 770 /opt/scripts/
|
RUN chmod -R 770 /opt/scripts/
|
||||||
RUN chown -R steam /opt/scripts
|
|
||||||
|
|
||||||
USER steam
|
|
||||||
|
|
||||||
#Server Start
|
#Server Start
|
||||||
ENTRYPOINT ["/opt/scripts/start-server.sh"]
|
ENTRYPOINT ["/opt/scripts/start.sh"]
|
35
README.md
35
README.md
@@ -1,42 +1,35 @@
|
|||||||
# SteamCMD in Docker optimized for Unraid
|
# SteamCMD in Docker optimized for Unraid
|
||||||
This Docker will download and install SteamCMD. It will also install Counter-Strike: Source and run it. Update Notice: Simply restart the container if a newer version of the game is available.
|
This Docker will download and install SteamCMD. It will also install Wreckfest and run it.
|
||||||
|
Servername: 'Wreckfest Docker' Password: 'Docker'
|
||||||
|
|
||||||
|
**Update Notice:** Simply restart the container if a newer version of the game is available.
|
||||||
|
|
||||||
|
**WEB CONSOLE:** You can connect to the Wreckfest console by opening your browser and go to HOSTIP:9028 (eg: 192.168.1.1:9028) or click on WebUI on the Docker page within Unraid.
|
||||||
|
|
||||||
## Env params
|
## Env params
|
||||||
| Name | Value | Example |
|
| Name | Value | Example |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| STEAMCMD_DIR | Folder for SteamCMD | /serverdata/steamcmd |
|
| STEAMCMD_DIR | Folder for SteamCMD | /serverdata/steamcmd |
|
||||||
| SERVER_DIR | Folder for gamefile | /serverdata/serverfiles |
|
| SERVER_DIR | Folder for gamefile | /serverdata/serverfiles |
|
||||||
| GAME_ID | SteamID for server | 232330 |
|
| GAME_ID | The GAME_ID that the container downloads at startup. If you want to install a static or beta version of the game change the value to: '361580 -beta YOURBRANCH' (without quotes, replace YOURBRANCH with the branch or version you want to install). | 361580 |
|
||||||
| GAME_NAME | SRCDS gamename | cstrike |
|
| GAME_PARAMS | Enter your start up commands for the server if needed. | none |
|
||||||
| GAME_PARAMS | Values to start the server | -secure +maxplayers 32 +map de_dust2 |
|
|
||||||
| UID | User Identifier | 99 |
|
| UID | User Identifier | 99 |
|
||||||
| GID | Group Identifier | 100 |
|
| GID | Group Identifier | 100 |
|
||||||
| GAME_PORT | Port the server will be running on | 27015 |
|
|
||||||
| VALIDATE | Validates the game data | true |
|
| VALIDATE | Validates the game data | true |
|
||||||
| USERNAME | Leave blank for anonymous login | blank |
|
| USERNAME | Leave blank for anonymous login | blank |
|
||||||
| PASSWRD | Leave blank for anonymous login | blank |
|
| PASSWRD | Leave blank for anonymous login | blank |
|
||||||
|
|
||||||
***ATTENTION: You have to disable Steam Guard for games that require authentication, Steam recommends to create a seperate account for dedicated servers***
|
|
||||||
|
|
||||||
>**NOTE** GAME_ID values can be found [here](https://developer.valvesoftware.com/wiki/Dedicated_Servers_List)
|
|
||||||
|
|
||||||
> And for GAME_NAME there is no list, so a quick search should give you the result
|
|
||||||
|
|
||||||
## Run example
|
## Run example
|
||||||
```
|
```
|
||||||
docker run --name CSSource -d \
|
docker run --name Wreckfest -d \
|
||||||
-p 27015:27015 -p 27015:27015/udp \
|
-p 33540:33540/udp -p 27015-27016:27015-27016/udp -p 9028:8080 \
|
||||||
--env 'GAME_ID=232330' \
|
--env 'GAME_ID=361580' \
|
||||||
--env 'GAME_NAME=cstrike' \
|
|
||||||
--env 'GAME_PORT=27015' \
|
|
||||||
--env 'GAME_PARAMS=-secure +maxplayers 32 +map de_dust2' \
|
|
||||||
--env 'UID=99' \
|
--env 'UID=99' \
|
||||||
--env 'GID=100' \
|
--env 'GID=100' \
|
||||||
--volume /mnt/user/appdata/steamcmd:/serverdata/steamcmd \
|
--volume /path/to/steamcmd:/serverdata/steamcmd \
|
||||||
--volume /mnt/user/appdata/cstrikesource:/serverdata/serverfiles \
|
--volume /path/to/cstrikesource:/serverdata/serverfiles \
|
||||||
ich777/steamcmd:latest
|
ich777/steamcmd:wreckfest
|
||||||
```
|
```
|
||||||
>**NOTE** port 26900 is the port for vac, in case of multiple servers make sure these are not the same
|
|
||||||
|
|
||||||
|
|
||||||
This Docker was mainly edited for better use with Unraid, if you don't use Unraid you should definitely try it!
|
This Docker was mainly edited for better use with Unraid, if you don't use Unraid you should definitely try it!
|
||||||
|
3
scripts/start-gotty.sh
Normal file
3
scripts/start-gotty.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sleep 5
|
||||||
|
TERM=linux gotty ${GOTTY_PARAMS} screen -xS Wreckfest
|
@@ -22,14 +22,16 @@ if [ "${USERNAME}" == "" ]; then
|
|||||||
if [ "${VALIDATE}" == "true" ]; then
|
if [ "${VALIDATE}" == "true" ]; then
|
||||||
echo "---Validating installation---"
|
echo "---Validating installation---"
|
||||||
${STEAMCMD_DIR}/steamcmd.sh \
|
${STEAMCMD_DIR}/steamcmd.sh \
|
||||||
+login anonymous \
|
+@sSteamCmdForcePlatformType windows \
|
||||||
+force_install_dir ${SERVER_DIR} \
|
+force_install_dir ${SERVER_DIR} \
|
||||||
|
+login anonymous \
|
||||||
+app_update ${GAME_ID} validate \
|
+app_update ${GAME_ID} validate \
|
||||||
+quit
|
+quit
|
||||||
else
|
else
|
||||||
${STEAMCMD_DIR}/steamcmd.sh \
|
${STEAMCMD_DIR}/steamcmd.sh \
|
||||||
+login anonymous \
|
+@sSteamCmdForcePlatformType windows \
|
||||||
+force_install_dir ${SERVER_DIR} \
|
+force_install_dir ${SERVER_DIR} \
|
||||||
|
+login anonymous \
|
||||||
+app_update ${GAME_ID} \
|
+app_update ${GAME_ID} \
|
||||||
+quit
|
+quit
|
||||||
fi
|
fi
|
||||||
@@ -37,26 +39,70 @@ else
|
|||||||
if [ "${VALIDATE}" == "true" ]; then
|
if [ "${VALIDATE}" == "true" ]; then
|
||||||
echo "---Validating installation---"
|
echo "---Validating installation---"
|
||||||
${STEAMCMD_DIR}/steamcmd.sh \
|
${STEAMCMD_DIR}/steamcmd.sh \
|
||||||
+login ${USERNAME} ${PASSWRD} \
|
+@sSteamCmdForcePlatformType windows \
|
||||||
+force_install_dir ${SERVER_DIR} \
|
+force_install_dir ${SERVER_DIR} \
|
||||||
|
+login ${USERNAME} ${PASSWRD} \
|
||||||
+app_update ${GAME_ID} validate \
|
+app_update ${GAME_ID} validate \
|
||||||
+quit
|
+quit
|
||||||
else
|
else
|
||||||
${STEAMCMD_DIR}/steamcmd.sh \
|
${STEAMCMD_DIR}/steamcmd.sh \
|
||||||
+login ${USERNAME} ${PASSWRD} \
|
+@sSteamCmdForcePlatformType windows \
|
||||||
+force_install_dir ${SERVER_DIR} \
|
+force_install_dir ${SERVER_DIR} \
|
||||||
|
+login ${USERNAME} ${PASSWRD} \
|
||||||
+app_update ${GAME_ID} \
|
+app_update ${GAME_ID} \
|
||||||
+quit
|
+quit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "---Prepare Server---"
|
echo "---Prepare Server---"
|
||||||
chmod -R 770 ${DATA_DIR}
|
export WINEARCH=win64
|
||||||
|
export WINEPREFIX=/serverdata/serverfiles/WINE64
|
||||||
|
export WINEDEBUG=-all
|
||||||
|
export DBUS_FATAL_WARNINGS=0
|
||||||
|
export DISPLAY=:99
|
||||||
|
echo "---Checking if WINE workdirectory is present---"
|
||||||
|
if [ ! -d ${SERVER_DIR}/WINE64 ]; then
|
||||||
|
echo "---WINE workdirectory not found, creating please wait...---"
|
||||||
|
mkdir ${SERVER_DIR}/WINE64
|
||||||
|
else
|
||||||
|
echo "---WINE workdirectory found---"
|
||||||
|
fi
|
||||||
|
echo "---Checking if WINE is properly installed---"
|
||||||
|
if [ ! -d ${SERVER_DIR}/WINE64/drive_c/windows ]; then
|
||||||
|
echo "---Setting up WINE---"
|
||||||
|
cd ${SERVER_DIR}
|
||||||
|
winecfg > /dev/null 2>&1
|
||||||
|
sleep 15
|
||||||
|
else
|
||||||
|
echo "---WINE properly set up---"
|
||||||
|
fi
|
||||||
|
if [ ! -f ~/.screenrc ]; then
|
||||||
|
echo "defscrollback 30000
|
||||||
|
bindkey \"^C\" echo 'Blocked. Please use to command \"exit\" to shutdown the server or close this window to exit the terminal.'" > ~/.screenrc
|
||||||
|
fi
|
||||||
|
if [ ! -f ${SERVER_DIR}/server_config.cfg ]; then
|
||||||
|
cp ${SERVER_DIR}/initial_server_config.cfg ${SERVER_DIR}/server_config.cfg
|
||||||
|
sed -i '/^#/!s/server_name=.*/server_name="Wreckfest Docker"/g' ${SERVER_DIR}/server_config.cfg
|
||||||
|
sed -i '/welcome_message=/c\welcome_message="Welcome to Wreckfest running on Docker"' ${SERVER_DIR}/server_config.cfg
|
||||||
|
sed -i '/^#/!s/password=.*/password="Docker"/g' ${SERVER_DIR}/server_config.cfg
|
||||||
|
else
|
||||||
|
echo "---'server_config.cfg' found..."
|
||||||
|
fi
|
||||||
|
echo "---Checking for old display lock files---"
|
||||||
|
find /tmp -name ".X99*" -exec rm -f {} \; > /dev/null 2>&1
|
||||||
|
chmod -R ${DATA_PERM} ${DATA_DIR}
|
||||||
echo "---Server ready---"
|
echo "---Server ready---"
|
||||||
|
|
||||||
echo "---Sleep zZz...---"
|
echo "---Starting Xvfb server---"
|
||||||
sleep infinity
|
Xvfb :99 -screen scrn 640x480x16 2>/dev/null &
|
||||||
|
sleep 3
|
||||||
|
|
||||||
echo "---Start Server---"
|
echo "---Start Server---"
|
||||||
cd ${SERVER_DIR}
|
cd ${SERVER_DIR}
|
||||||
${SERVER_DIR}/srcds_run -game ${GAME_NAME} ${GAME_PARAMS} -console +port ${GAME_PORT}
|
screen -S Wreckfest -d -m wine64 Wreckfest_x64.exe -s server_config=server_config.cfg ${GAME_PARAMS}
|
||||||
|
sleep 1
|
||||||
|
if [ "${ENABLE_WEBCONSOLE}" == "true" ]; then
|
||||||
|
/opt/scripts/start-gotty.sh 2>/dev/null &
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
tail --pid=$(pgrep Wreckfest_x64.e) -f /dev/null
|
41
scripts/start.sh
Normal file
41
scripts/start.sh
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "---Ensuring UID: ${UID} matches user---"
|
||||||
|
usermod -u ${UID} ${USER}
|
||||||
|
echo "---Ensuring GID: ${GID} matches user---"
|
||||||
|
groupmod -g ${GID} ${USER} > /dev/null 2>&1 ||:
|
||||||
|
usermod -g ${GID} ${USER}
|
||||||
|
echo "---Setting umask to ${UMASK}---"
|
||||||
|
umask ${UMASK}
|
||||||
|
|
||||||
|
echo "---Checking for optional scripts---"
|
||||||
|
cp -f /opt/custom/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
|
||||||
|
cp -f /opt/scripts/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
|
||||||
|
|
||||||
|
if [ -f /opt/scripts/start-user.sh ]; then
|
||||||
|
echo "---Found optional script, executing---"
|
||||||
|
chmod -f +x /opt/scripts/start-user.sh ||:
|
||||||
|
/opt/scripts/start-user.sh || echo "---Optional Script has thrown an Error---"
|
||||||
|
else
|
||||||
|
echo "---No optional script found, continuing---"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "---Taking ownership of data...---"
|
||||||
|
chown -R root:${GID} /opt/scripts
|
||||||
|
chmod -R 750 /opt/scripts
|
||||||
|
chown -R ${UID}:${GID} ${DATA_DIR}
|
||||||
|
|
||||||
|
echo "---Starting...---"
|
||||||
|
term_handler() {
|
||||||
|
kill -SIGTERM $(pgrep Wreckfest_x64.e)
|
||||||
|
tail --pid=$(pgrep Wreckfest_x64.e) -f 2>/dev/null
|
||||||
|
exit 143;
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'kill ${!}; term_handler' SIGTERM
|
||||||
|
su ${USER} -c "/opt/scripts/start-server.sh" &
|
||||||
|
killpid="$!"
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
wait $killpid
|
||||||
|
exit 0;
|
||||||
|
done
|
Reference in New Issue
Block a user