From 88180b3f5c58426d2cd478a93d96b7ecff16af2a Mon Sep 17 00:00:00 2001 From: Charles Morgan Date: Mon, 21 Jun 2021 19:27:00 -0400 Subject: [PATCH] Add Base Debian (#5) --- .github/workflows/{alpine.yml => base.yml} | 16 +++++--- README.md | 4 ++ {alpine => oses/alpine}/Dockerfile | 0 {alpine => oses/alpine}/entrypoint.sh | 0 oses/debian/Dockerfile | 23 +++++++++++ oses/debian/entrypoint.sh | 45 ++++++++++++++++++++++ 6 files changed, 82 insertions(+), 6 deletions(-) rename .github/workflows/{alpine.yml => base.yml} (68%) rename {alpine => oses/alpine}/Dockerfile (100%) rename {alpine => oses/alpine}/entrypoint.sh (100%) create mode 100644 oses/debian/Dockerfile create mode 100644 oses/debian/entrypoint.sh diff --git a/.github/workflows/alpine.yml b/.github/workflows/base.yml similarity index 68% rename from .github/workflows/alpine.yml rename to .github/workflows/base.yml index 2e606c0..3a37190 100644 --- a/.github/workflows/alpine.yml +++ b/.github/workflows/base.yml @@ -1,4 +1,4 @@ -name: build alpine +name: build oses on: schedule: - cron: "0 0 * * 1" @@ -6,13 +6,17 @@ on: branches: - master paths: - - alpine/** + - oses/** jobs: push: - name: "yolks:alpine" + name: "yolks:${{ matrix.oses }}" runs-on: ubuntu-latest strategy: fail-fast: false + matrix: + oses: + - alpine + - debian steps: - uses: actions/checkout@v2 - uses: docker/setup-buildx-action@v1 @@ -26,9 +30,9 @@ jobs: password: ${{ secrets.REGISTRY_TOKEN }} - uses: docker/build-push-action@v2 with: - context: ./alpine - file: ./alpine/Dockerfile + context: ./oses/${{ matrix.oses }} + file: ./oses/${{ matrix.oses }}/Dockerfile platforms: linux/amd64 push: true tags: | - ghcr.io/pterodactyl/yolks:alpine + ghcr.io/pterodactyl/yolks:${{ matrix.oses }} diff --git a/README.md b/README.md index 1ea0849..852717e 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,10 @@ is tagged correctly. ## Available Images +* [`alpine`](https://github.com/pterodactyl/yolks/tree/master/oses/alpine) + * `ghcr.io/pterodactyl/yolks:alpine` +* [`debian`](https://github.com/pterodactyl/yolks/tree/master/oses/debian) + * `ghcr.io/pterodactyl/yolks:debian` * [`fivem`](https://github.com/pterodactyl/yolks/tree/master/games/fivem) * `ghcr.io/pterodactyl/games:fivem` * [`golang`](https://github.com/pterodactyl/yolks/tree/master/go) diff --git a/alpine/Dockerfile b/oses/alpine/Dockerfile similarity index 100% rename from alpine/Dockerfile rename to oses/alpine/Dockerfile diff --git a/alpine/entrypoint.sh b/oses/alpine/entrypoint.sh similarity index 100% rename from alpine/entrypoint.sh rename to oses/alpine/entrypoint.sh diff --git a/oses/debian/Dockerfile b/oses/debian/Dockerfile new file mode 100644 index 0000000..ecf0b0f --- /dev/null +++ b/oses/debian/Dockerfile @@ -0,0 +1,23 @@ +FROM --platform=linux/amd64 debian:buster-slim + +LABEL author="Michael Parker" maintainer="parker@pterodactyl.io" + +LABEL org.opencontainers.image.source="https://github.com/pterodactyl/yolks" +LABEL org.opencontainers.image.licenses=MIT + +RUN apt update && apt upgrade -y \ + && apt install -y gcc g++ libgcc1 lib32gcc1 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 libicu63 icu-devtools libunwind8 libssl-dev sqlite3 libsqlite3-dev libmariadbclient-dev libduktape203 locales ffmpeg gnupg2 apt-transport-https software-properties-common ca-certificates tzdata \ + liblua5.3 libz-dev rapidjson-dev \ + && update-locale lang=en_US.UTF-8 \ + && dpkg-reconfigure --frontend noninteractive locales \ + && useradd -m -d /home/container -s /bin/bash container + +USER container +ENV USER=container HOME=/home/container +ENV DEBIAN_FRONTEND noninteractive + +WORKDIR /home/container + +COPY ./entrypoint.sh /entrypoint.sh +CMD [ "/bin/bash", "/entrypoint.sh" ] diff --git a/oses/debian/entrypoint.sh b/oses/debian/entrypoint.sh new file mode 100644 index 0000000..d5cfc60 --- /dev/null +++ b/oses/debian/entrypoint.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# +# Copyright (c) 2021 Matthew Penner +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# 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;exit}') +export INTERNAL_IP + +# Switch to the container's working directory +cd /home/container || exit 1 + +# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell +# variable format of "${VARIABLE}" before evaluating the string and automatically +# replacing the values. +PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") + +# Display the command we're running in the output, and then execute it with the env +# from the container itself. +printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" +# shellcheck disable=SC2086 +exec env ${PARSED}