From 244bcbc6b1788e788459d1741ddd2a1d1ae3e507 Mon Sep 17 00:00:00 2001 From: laraproto Date: Sun, 27 Oct 2024 12:27:29 +0200 Subject: [PATCH] meow --- .github/workflows/mono.yml | 38 ++++++++++++++++++ .gitignore | 79 ++++++++++++++++++++++++++++++++++++++ .idea/.gitignore | 8 ++++ .idea/discord.xml | 7 ++++ .idea/misc.xml | 6 +++ .idea/modules.xml | 8 ++++ .idea/vcs.xml | 6 +++ .idea/yolks.iml | 9 +++++ mono/entrypoint.sh | 52 +++++++++++++++++++++++++ mono/latest/Dockerfile | 28 ++++++++++++++ 10 files changed, 241 insertions(+) create mode 100644 .github/workflows/mono.yml create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/discord.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/yolks.iml create mode 100644 mono/entrypoint.sh create mode 100644 mono/latest/Dockerfile diff --git a/.github/workflows/mono.yml b/.github/workflows/mono.yml new file mode 100644 index 0000000..fa46ad6 --- /dev/null +++ b/.github/workflows/mono.yml @@ -0,0 +1,38 @@ +name: build mono +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 1" + push: + branches: + - master + paths: + - mono/** +jobs: + push: + name: "yolks:mono_${{ matrix.tag }}" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + tag: + - latest + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + with: + buildkitd-flags: --debug + - uses: docker/login-action@v3 + with: + registry: git.styandco.dev + username: ${{ github.repository_owner }} + password: ${{ secrets.REGISTRY_TOKEN }} + - uses: docker/build-push-action@v5 + with: + context: ./mono + file: ./mono/${{ matrix.tag }}/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/pelican-eggs/yolks:mono_${{ matrix.tag }} + ghcr.io/parkervcp/yolks:mono_${{ matrix.tag }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eb4a17 --- /dev/null +++ b/.gitignore @@ -0,0 +1,79 @@ +### Intellij+iml template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..d8e9561 --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..106ec0f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b59bb1f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/yolks.iml b/.idea/yolks.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/yolks.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/mono/entrypoint.sh b/mono/entrypoint.sh new file mode 100644 index 0000000..7e36894 --- /dev/null +++ b/mono/entrypoint.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# 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 + +# 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 1007 +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 1007 +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 +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 diff --git a/mono/latest/Dockerfile b/mono/latest/Dockerfile new file mode 100644 index 0000000..4022fcd --- /dev/null +++ b/mono/latest/Dockerfile @@ -0,0 +1,28 @@ +FROM --platform=$TARGETOS/$TARGETARCH ghcr.io/parkervcp/yolks:debian + +LABEL authors="Torsten Widmann, Lara The Protogen" + +RUN apt update \ + && apt -y upgrade +RUN apt install -y fontconfig dirmngr numactl +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 wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb +RUN dpkg -i packages-microsoft-prod.deb +RUN apt update +RUN apt install -y mono-complete dotnet-runtime-8.0 + +# 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 +ENV USER=container HOME=/home/container +WORKDIR /home/container + +COPY ./entrypoint.sh /entrypoint.sh +CMD [ "/bin/bash", "/entrypoint.sh" ] \ No newline at end of file