mono: make steamcmd work and build for arm64

This commit is contained in:
Quinten
2023-10-11 19:29:25 +02:00
committed by GitHub
parent 33e2794a5c
commit cbe953c448
3 changed files with 56 additions and 9 deletions

View File

@@ -31,7 +31,7 @@ jobs:
with: with:
context: ./mono context: ./mono
file: ./mono/${{ matrix.tag }}/Dockerfile file: ./mono/${{ matrix.tag }}/Dockerfile
platforms: linux/amd64 platforms: linux/amd64,linux/arm64
push: true push: true
tags: | tags: |
ghcr.io/parkervcp/yolks:mono_${{ matrix.tag }} ghcr.io/parkervcp/yolks:mono_${{ matrix.tag }}

View File

@@ -1,13 +1,52 @@
#!/bin/bash #!/bin/bash
cd /home/container # Wait for the container to fully initialize
sleep 1
# Make internal Docker IP address available to processes. # 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}') INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP export INTERNAL_IP
# Switch to the container's working directory
cd /home/container || exit 1
if [ ! -z "${SRCDS_APPID}" ]; then
## 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} $( [[ -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}" ) $( [[ -z ${VALIDATE} ]] || 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} $( [[ -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}" ) $( [[ -z ${VALIDATE} ]] || 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
fi
# Replace Startup Variables # Replace Startup Variables
MODIFIED_STARTUP="eval $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')" MODIFIED_STARTUP=$(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
echo ":/home/container$ ${MODIFIED_STARTUP}" echo -e ":/home/container$ ${MODIFIED_STARTUP}"
# Run the Server # Run the Server
${MODIFIED_STARTUP} eval ${MODIFIED_STARTUP}

View File

@@ -1,14 +1,22 @@
FROM ghcr.io/parkervcp/yolks:debian FROM --platform=$TARGETOS/$TARGETARCH ghcr.io/parkervcp/yolks:debian
LABEL author="Torsten Widmann" maintainer="support@goover.de" LABEL author="Torsten Widmann" maintainer="support@goover.de"
RUN apt update \ RUN apt update \
&& apt -y upgrade && apt -y upgrade
RUN apt install -y fontconfig dirmngr RUN apt install -y fontconfig dirmngr numactl
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
RUN sh -c 'echo "deb https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list' RUN sh -c 'echo "deb https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list'
RUN apt update RUN apt update
RUN apt install -y mono-complete lib32gcc-s1 RUN apt install -y mono-complete
# Only install the needed steamcmd packages on the AMD64 build
RUN if [ "$(uname -m)" = "x86_64" ]; then \
dpkg --add-architecture i386 && \
apt update && \
apt -y install lib32gcc-s1 libsdl2-2.0-0:i386; \
fi
USER container USER container
ENV USER=container HOME=/home/container ENV USER=container HOME=/home/container