Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gOOvER committed Oct 14, 2023
1 parent aff050a commit 7b0f93c
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/games.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- samp
- screeps
- staxel
- thefront
- valheim
- wurm

Expand Down
120 changes: 120 additions & 0 deletions games/thefront/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
FROM --platform=$BUILDPLATFORM debian:bookworm-slim

LABEL author="Torsten Widmann" maintainer="info@goover.de"
LABEL org.opencontainers.image.source="https://github.com/gOOvER/own-pterodactyl-images"
LABEL org.opencontainers.image.licenses=MIT

# Sets the default stop signal as wings can (currently) only send a kill or generic stop
STOPSIGNAL SIGINT

ENV DEBIAN_FRONTEND=noninteractive

RUN dpkg --add-architecture i386
RUN apt update \
&& apt -y upgrade

RUN apt install -y \
ca-certificates \
curl \
dbus \
dirmngr \
g++ \
gcc \
gdb \
git \
gnupg \
iproute2 \
jq \
mesa-utils \
net-tools \
netcat-openbsd \
numactl \
psmisc \
python3 \
python3-dev \
python3-pip \
sed \
speex:i386 \
tar \
telnet \
tzdata \
wget \
lib32gcc-s1 \
lib32stdc++6 \
lib32tinfo6 \
lib32z1 \
libasound2 \
libatk1.0-0 \
libc++1 \
libc6:i386 \
libcurl4 \
libcurl4:i386 \
libcurl4-gnutls-dev:i386 \
libfontconfig1 \
libgcc1 \
libgconf-2-4 \
libgdiplus \
libgtk2.0-0:i386 \
libncurses5:i386 \
libnss-wrapper \
libnss-wrapper:i386 \
libnss3 \
libpangocairo-1.0-0 \
libpulse-dev \
libsdl1.2debian \
libsdl1.2debian:i386 \
libsdl2-2.0-0 \
libsdl2-2.0-0:i386 \
libssl3 \
libssl3:i386 \
libstdc++6 \
libstdc++6:i386 \
libtcmalloc-minimal4 \
libtinfo6:i386 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxi6 \
libxrandr2 \
libxss1 \
libxtst6

## install dotnet to support STEAM dotnet games
RUN apt update -y \
&& apt upgrade -y \
&& 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

## install mono to support STEAM dotnet games
RUN gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
RUN echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list
RUN apt update
RUN apt install mono-complete -y

## 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/

## Prepare NSS Wrapper for the entrypoint as a workaround for Arma 3 requiring a valid UID
ENV NSS_WRAPPER_PASSWD=/tmp/passwd NSS_WRAPPER_GROUP=/tmp/group
RUN touch ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP} \
&& chgrp 0 ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP} \
&& chmod g+rw ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP}
ADD passwd.template /passwd.template

## Setup user and working directory
RUN useradd -m -d /home/container -s /bin/bash container
USER container
ENV USER=container HOME=/home/container
WORKDIR /home/container

## Copy over and execute entrypoint.sh
COPY ./../entrypoint.sh /entrypoint.sh
CMD [ "/bin/bash", "/entrypoint.sh" ]
99 changes: 99 additions & 0 deletions games/thefront/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/bin/bash

clear
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'

# 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

# Information output
echo -e "${BLUE}-------------------------------------------------${NC}"
echo -e "${RED}The Front Image by gOOvER${NC}"
echo -e "${BLUE}-------------------------------------------------${NC}"
echo -e "${YELLOW}Running on Debian: ${RED} $(cat /etc/debian_version)${NC}"
echo -e "${YELLOW}Current timezone: ${RED} $(cat /etc/timezone)${NC}"
echo -e "${YELLOW}DotNet Version: ${RED} $(dotnet --version) ${NC}"
echo -e "${YELLOW}Mono Version: ${RED} $(mono --version) ${NC}"
echo -e "${BLUE}-------------------------------------------------${NC}"

# 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}"
#protontricks
#export STEAM_DIR="/home/container/.steam/steam"
export WINETRICKS="/usr/sbin/winetricks"
#export STEAM_RUNTIME=1

else
echo -e "${BLUE}----------------------------------------------------------------------------------${NC}"
echo -e "${RED}WARNING!!! Proton needs variable SRCDS_APPID, else it will not work. Please add it${NC}"
echo -e "${RED}Server stops now${NC}"
echo -e "${BLUE}----------------------------------------------------------------------------------${NC}"
exit 0
fi
fi

# Switch to the container's working directory
cd /home/container || exit 1

echo -e "${BLUE}-------------------------------------------------${NC}"
echo -e "${GREEN}Starting Server.... Please wait...${NC}"
echo -e "${BLUE}-------------------------------------------------${NC}"

## just in case someone removed the defaults.
if [ "${STEAM_USER}" == "" ]; then
echo -e "${BLUE}-------------------------------------------------${NC}"
echo -e "${YELLOW}Steam user is not set. ${NC}"
echo -e "${YELLOW}Using anonymous user.${NC}"
echo -e "${BLUE}-------------------------------------------------${NC}"
STEAM_USER=anonymous
STEAM_PASS=""
STEAM_AUTH=""
else
echo -e "${BLUE}-------------------------------------------------${NC}"
echo -e "${YELLOW}user set to ${STEAM_USER} ${NC}"
echo -e "${BLUE}-------------------------------------------------${NC}"
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 1007 +app_update ${SRCDS_APPID} +download_depot 2334200 2334201 6275183211335651031 $( [[ -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 "${BLUE}-------------------------------------------------${NC}"
echo -e "${YELLOW}No appid set. Starting Server${NC}"
echo -e "${BLUE}-------------------------------------------------${NC}"
fi

else
echo -e "${BLUE}---------------------------------------------------------------${NC}"
echo -e "${YELLOW}Not updating game server as auto update was set to 0. Starting Server${NC}"
echo -e "${BLUE}---------------------------------------------------------------${NC}"
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}

0 comments on commit 7b0f93c

Please sign in to comment.