From 2287ac87165d7ecfe89a9588fac95ad4fc868869 Mon Sep 17 00:00:00 2001 From: zontreck Date: Wed, 4 Sep 2024 19:00:30 -0700 Subject: [PATCH] Add steamcmd dotnet --- Jenkinsfile | 2 ++ build.sh | 3 +- steamcmd/dotnet/Dockerfile | 45 ++++++++++++++++++++++++ steamcmd/dotnet/entrypoint.sh | 66 +++++++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 steamcmd/dotnet/Dockerfile create mode 100644 steamcmd/dotnet/entrypoint.sh diff --git a/Jenkinsfile b/Jenkinsfile index 11a6874..5785c5f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -209,6 +209,7 @@ pipeline { #!/bin/bash docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_debian steamcmd/debian + docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_dotnet steamcmd/dotnet ''' } } @@ -225,6 +226,7 @@ pipeline { #!/bin/bash docker push git.zontreck.com/ariascreations/yolks:steamcmd_debian + docker push git.zontreck.com/ariascreations/yolks:steamcmd_dotnet ''' } } diff --git a/build.sh b/build.sh index 3647fb3..2f7283b 100755 --- a/build.sh +++ b/build.sh @@ -31,4 +31,5 @@ docker build -t git.zontreck.com/ariascreations/yolks:installers_debian installe 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 \ No newline at end of file +docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_debian steamcmd/debian +docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_dotnet steamcmd/dotnet \ No newline at end of file diff --git a/steamcmd/dotnet/Dockerfile b/steamcmd/dotnet/Dockerfile new file mode 100644 index 0000000..700579c --- /dev/null +++ b/steamcmd/dotnet/Dockerfile @@ -0,0 +1,45 @@ +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 + +RUN apt-get install -y python3 python3-dev apt-transport-https iproute2 sqlite3 xvfb libgdiplus + +RUN wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ + && dpkg -i packages-microsoft-prod.deb \ + && rm packages-microsoft-prod.deb \ + && apt update -y \ + && apt install -y aspnetcore-runtime-7.0 dotnet-sdk-7.0 libgdiplus aspnetcore-runtime-8.0 dotnet-sdk-8.0 + +## 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 + + +RUN useradd -m container +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"] \ No newline at end of file diff --git a/steamcmd/dotnet/entrypoint.sh b/steamcmd/dotnet/entrypoint.sh new file mode 100644 index 0000000..04dbf26 --- /dev/null +++ b/steamcmd/dotnet/entrypoint.sh @@ -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} \ No newline at end of file