feat(games/fivem): add custom docker image

This commit is contained in:
darksaid98 committed 2023-09-27 00:34:15 +02:00
1 parent 046a892318
commit 47eb75ec65
3 files changed
+134 -8

No files matched your search

+41 -8
View File
@@ -9,20 +9,23 @@ on:
paths:
- games/**
jobs:
pushAll:
name: "games_All:${{ matrix.game }}"
pushAMD64:
name: "games_AMD64:${{ matrix.game }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
game:
- valheim
- altv
- arma3
- dayz
- fivem
- mohaa
- samp
- source
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
@@ -35,7 +38,37 @@ jobs:
with:
context: ./games/${{ matrix.game }}
file: ./games/${{ matrix.game }}/Dockerfile
platforms: linux/arm64
platforms: linux/amd64
push: true
tags: |
ghcr.io/darksaid98/games:${{ matrix.game }}
pushAll:
name: "games_All:${{ matrix.game }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
game:
- minetest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64,amd64
- uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
context: ./games/${{ matrix.game }}
file: ./games/${{ matrix.game }}/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/darksaid98/games:${{ matrix.game }}
+34
View File
@@ -0,0 +1,34 @@
FROM --platform=$TARGETOS/$TARGETARCH debian:bullseye-slim
LABEL author="Michael Parker" maintainer="[email protected]"
LABEL org.opencontainers.image.source="https://github.com/pterodactyl/yolks"
LABEL org.opencontainers.image.licenses=MIT
ENV DEBIAN_FRONTEND noninteractive
RUN useradd -m -d /home/container -s /bin/bash container
RUN ln -s /home/container/ /nonexistent
ENV USER=container HOME=/home/container
## Update base packages
RUN apt update \
&& apt upgrade -y
## Install dependencies
RUN apt install -y gcc g++ libgcc1 libc++-dev gdb libc6 git wget curl tar zip unzip binutils xz-utils liblzo2-2 cabextract iproute2 net-tools netcat telnet libatomic1 libsdl1.2debian libsdl2-2.0-0 \
libfontconfig libicu67 icu-devtools libunwind8 libssl-dev sqlite3 libsqlite3-dev libmariadbclient-dev-compat libduktape205 locales ffmpeg gnupg2 apt-transport-https software-properties-common ca-certificates \
liblua5.3-0 libz-dev rapidjson-dev tzdata libevent-dev libzip4 libprotobuf23 libfluidsynth2 procps libstdc++6
## Configure locale
RUN update-locale lang=en_US.UTF-8 \
&& dpkg-reconfigure --frontend noninteractive locales
WORKDIR /home/container
COPY ./entrypoint.sh /entrypoint.sh
CMD [ "/bin/bash", "/entrypoint.sh" ]
+59
View File
@@ -0,0 +1,59 @@
#!/bin/bash
cd /home/container
# Make internal Docker IP address available to processes.
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP
# Auto update resources from git.
if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then
# Pre git stuff
echo "Wait, preparing to pull or clone from Git.";
cd /home/container/resources
# Git stuff
if [[ ${GIT_REPOURL} != *.git ]]; then # Add .git at end of URL
GIT_REPOURL=${GIT_REPOURL}.git
fi
if [ -z "${GIT_USERNAME}" ] && [ -z "${GIT_TOKEN}" ]; then # Check for git username & token
echo -e "Git Username or Git Token was not specified."
else
GIT_REPOURL="https://${GIT_USERNAME}:${GIT_TOKEN}@$(echo -e ${GIT_REPOURL} | cut -d/ -f3-)"
fi
if [ "$(ls -A /home/container/resources)" ]; then # Files exist in resources folder, pull
# Get git origin from /home/container/resources/.git/config
if [ -d .git ]; then
if [ -f .git/config ]; then
GIT_ORIGIN=$(git config --get remote.origin.url)
fi
fi
# If git origin matches the repo specified by user then pull
if [ "${GIT_ORIGIN}" == "${GIT_REPOURL}" ]; then #
git pull && echo "Finished pulling /resources/* from Git." || echo "Failed pulling /resources/* from Git."
fi
else # No files exist in resources folder, clone
echo -e "Resources directory is empty."
if [ -z ${GIT_BRANCH} ]; then
echo -e "Cloning default branch into /resources/*."
git clone ${GIT_REPOURL} .
else
echo -e "Cloning ${GIT_BRANCH} branch into /resources/*."
git clone --single-branch --branch ${GIT_BRANCH} ${GIT_REPOURL} . && echo "Finished cloning into /resources/* from Git." || echo "Failed cloning into /resources/* from Git."
fi
fi
# Post git stuff
cd /home/container
fi
# Replace Startup Variables
MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
echo -e ":/home/container$ ${MODIFIED_STARTUP}"
# Run the Server
eval ${MODIFIED_STARTUP}