diff --git a/Jenkinsfile b/Jenkinsfile index 5785c5f..9b53061 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -210,6 +210,7 @@ pipeline { docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_debian steamcmd/debian docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_dotnet steamcmd/dotnet + docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_proton steamcmd/proton ''' } } @@ -227,6 +228,7 @@ pipeline { docker push git.zontreck.com/ariascreations/yolks:steamcmd_debian docker push git.zontreck.com/ariascreations/yolks:steamcmd_dotnet + docker push git.zontreck.com/ariascreations/yolks:steamcmd_proton ''' } } diff --git a/build.sh b/build.sh index 2f7283b..0fbe536 100755 --- a/build.sh +++ b/build.sh @@ -32,4 +32,5 @@ docker build -t git.zontreck.com/ariascreations/yolks:installers_ubuntu installe # SteamCmd Containers 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 +docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_dotnet steamcmd/dotnet +docker build -t git.zontreck.com/ariascreations/yolks:steamcmd_proton steamcmd/proton \ No newline at end of file diff --git a/steamcmd/proton/Dockerfile b/steamcmd/proton/Dockerfile new file mode 100644 index 0000000..826d2fd --- /dev/null +++ b/steamcmd/proton/Dockerfile @@ -0,0 +1,47 @@ +FROM debian:bookworm + +LABEL author="Tara Piccari" maintainer="tarapiccari@gmail.com" +LABEL upstream="https://github.com/pelican-eggs/yolks" + + +## install required packages +RUN dpkg --add-architecture i386 +RUN apt update +RUN apt install -y --no-install-recommends wget iproute2 gnupg2 software-properties-common libntlm0 winbind xvfb xauth libncurses5-dev:i386 libncurses6 dbus libgdiplus lib32gcc-s1 +RUN apt install -y alsa-tools libpulse0 pulseaudio libpulse-dev libasound2 libao-common gnutls-bin gnupg locales numactl cabextract curl python3 python3-pip python3-setuptools file pipx +RUN useradd -d /home/container -m container + +# Download Proton GE +RUN curl -sLOJ "$(curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep .tar.gz)" +RUN tar -xzf GE-Proton*.tar.gz -C /usr/local/bin/ --strip-components=1 +RUN rm GE-Proton*.* + +# Proton Fix machine-id +RUN rm -f /etc/machine-id +RUN dbus-uuidgen --ensure=/etc/machine-id +RUN rm /var/lib/dbus/machine-id +RUN dbus-uuidgen --ensure + +#Setup Protontricks +RUN pipx install protontricks + +# Set up Winetricks +RUN wget -q -O /usr/sbin/winetricks https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks \ + && chmod +x /usr/sbin/winetricks + +## 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/ + +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/proton/entrypoint.sh b/steamcmd/proton/entrypoint.sh new file mode 100644 index 0000000..04dbf26 --- /dev/null +++ b/steamcmd/proton/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