Add debian steamcmd container

This commit is contained in:
zontreck 2024-09-04 18:47:40 -07:00
parent 4223463e18
commit 5af9aad161
5 changed files with 205 additions and 1 deletions

32
Jenkinsfile vendored
View file

@ -198,6 +198,38 @@ pipeline {
}
}
stage("Build Steamcmd") {
agent {
label 'dockermain'
}
steps {
script {
sh '''
#!/bin/bash
docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_debian steamcmd/debian
'''
}
}
}
stage("Push steamcmd") {
agent {
label 'dockermain'
}
steps {
script {
sh '''
#!/bin/bash
docker push git.zontreck.com/ariascreations/yolks:steamcmd_debian
'''
}
}
}
stage("Cleanup") {
agent {
label 'dockermain'

View file

@ -28,4 +28,7 @@ docker build -t git.zontreck.com/ariascreations/yolks:wine_9.16 wine/9.16
# Installers
docker build -t git.zontreck.com/ariascreations/yolks:installers_alpine installers/alpine
docker build -t git.zontreck.com/ariascreations/yolks:installers_debian installers/debian
docker build -t git.zontreck.com/ariascreations/yolks:installers_ubuntu installers/ubuntu
docker build -t git.zontreck.com/ariascreations/yolks:installers_ubuntu installers/ubuntu
# SteamCmd Containers
docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_debian steamcmd/debian

View file

@ -0,0 +1,37 @@
FROM debian:bookworm
LABEL author="Tara Piccari" maintainer="tarapiccari@gmail.com"
LABEL upstream="https://github.com/pelican-eggs/yolks"
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg-add-architecture=i386
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y tar curl gcc build-essential g++ lib32gcc-s1 libgcc-12-dev libgcc-11-dev libcurl4-gnutls-dev:i386 libssl-dev:i386 libcurl4:i386 lib32tinfo6 libtinfo6:i386 lib32z1 lib32stdc++6 libncurses5:i386 libcurl3-gnutls:i386 libsdl2-2.0-0:i386 libsdl2-2.0-0 iproute2 gdb libsdl1.2debian libfontconfig1 telnet net-tools netcat-traditional tzdata numactl xvfb wget
## install rcon
RUN cd /tmp/ \
&& curl -sSL https://github.com/gorcon/rcon-cli/releases/download/v0.10.3/rcon-0.10.3-amd64_linux.tar.gz > rcon.tar.gz \
&& tar xvf rcon.tar.gz \
&& mv rcon-0.10.3-amd64_linux/rcon /usr/local/bin/
# Temp fix for things that still need libssl1.1
RUN if [ "$(uname -m)" = "x86_64" ]; then \
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb && \
dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb && \
rm libssl1.1_1.1.0g-2ubuntu4_amd64.deb; \
fi
USER container
ENV USER=container HOME=/home/container
WORKDIR /home/container
STOPSIGNAL SIGINT
COPY --chown=container:container ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/bin/bash", "-c", "--"]
CMD ["/entrypoint.sh"]

View file

@ -0,0 +1,66 @@
# Wait for the container to fully initialize
sleep 1
# Default the TZ environment variable to UTC.
TZ=${TZ:-UTC}
export TZ
# Set environment variable that holds the Internal Docker IP
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP
# Set environment for Steam Proton
if [ -f "/usr/local/bin/proton" ]; then
if [ ! -z ${SRCDS_APPID} ]; then
mkdir -p /home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}
export STEAM_COMPAT_CLIENT_INSTALL_PATH="/home/container/.steam/steam"
export STEAM_COMPAT_DATA_PATH="/home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}"
# Fix for pipx with protontricks
export PATH=$PATH:/root/.local/bin
else
echo -e "----------------------------------------------------------------------------------"
echo -e "WARNING!!! Proton needs variable SRCDS_APPID, else it will not work. Please add it"
echo -e "Server stops now"
echo -e "----------------------------------------------------------------------------------"
exit 0
fi
fi
# Switch to the container's working directory
cd /home/container || exit 1
## just in case someone removed the defaults.
if [ "${STEAM_USER}" == "" ]; then
echo -e "steam user is not set.\n"
echo -e "Using anonymous user.\n"
STEAM_USER=anonymous
STEAM_PASS=""
STEAM_AUTH=""
else
echo -e "user set to ${STEAM_USER}"
fi
## if auto_update is not set or to 1 update
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
# Update Source Server
if [ ! -z ${SRCDS_APPID} ]; then
if [ "${STEAM_USER}" == "anonymous" ]; then
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update ${SRCDS_APPID} +app_update 1007 $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) ${INSTALL_FLAGS} $( [[ "${VALIDATE}" == "1" ]] && printf %s 'validate' ) +quit
else
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update ${SRCDS_APPID} +app_update 1007 $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) ${INSTALL_FLAGS} $( [[ "${VALIDATE}" == "1" ]] && printf %s 'validate' ) +quit
fi
else
echo -e "No appid set. Starting Server"
fi
else
echo -e "Not updating game server as auto update was set to 0. Starting Server"
fi
# Replace Startup Variables
MODIFIED_STARTUP=$(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
echo -e ":/home/container$ ${MODIFIED_STARTUP}"
# Run the Server
eval ${MODIFIED_STARTUP}

66
steamcmd/entrypoint.sh Normal file
View file

@ -0,0 +1,66 @@
# Wait for the container to fully initialize
sleep 1
# Default the TZ environment variable to UTC.
TZ=${TZ:-UTC}
export TZ
# Set environment variable that holds the Internal Docker IP
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP
# Set environment for Steam Proton
if [ -f "/usr/local/bin/proton" ]; then
if [ ! -z ${SRCDS_APPID} ]; then
mkdir -p /home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}
export STEAM_COMPAT_CLIENT_INSTALL_PATH="/home/container/.steam/steam"
export STEAM_COMPAT_DATA_PATH="/home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}"
# Fix for pipx with protontricks
export PATH=$PATH:/root/.local/bin
else
echo -e "----------------------------------------------------------------------------------"
echo -e "WARNING!!! Proton needs variable SRCDS_APPID, else it will not work. Please add it"
echo -e "Server stops now"
echo -e "----------------------------------------------------------------------------------"
exit 0
fi
fi
# Switch to the container's working directory
cd /home/container || exit 1
## just in case someone removed the defaults.
if [ "${STEAM_USER}" == "" ]; then
echo -e "steam user is not set.\n"
echo -e "Using anonymous user.\n"
STEAM_USER=anonymous
STEAM_PASS=""
STEAM_AUTH=""
else
echo -e "user set to ${STEAM_USER}"
fi
## if auto_update is not set or to 1 update
if [ -z ${AUTO_UPDATE} ] || [ "${AUTO_UPDATE}" == "1" ]; then
# Update Source Server
if [ ! -z ${SRCDS_APPID} ]; then
if [ "${STEAM_USER}" == "anonymous" ]; then
./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update ${SRCDS_APPID} +app_update 1007 $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) ${INSTALL_FLAGS} $( [[ "${VALIDATE}" == "1" ]] && printf %s 'validate' ) +quit
else
numactl --physcpubind=+0 ./steamcmd/steamcmd.sh +force_install_dir /home/container +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update ${SRCDS_APPID} +app_update 1007 $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) $( [[ -z ${HLDS_GAME} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}" ) ${INSTALL_FLAGS} $( [[ "${VALIDATE}" == "1" ]] && printf %s 'validate' ) +quit
fi
else
echo -e "No appid set. Starting Server"
fi
else
echo -e "Not updating game server as auto update was set to 0. Starting Server"
fi
# Replace Startup Variables
MODIFIED_STARTUP=$(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
echo -e ":/home/container$ ${MODIFIED_STARTUP}"
# Run the Server
eval ${MODIFIED_STARTUP}