From eaa2d8a25d40f821203123bba75d59b0ae097da9 Mon Sep 17 00:00:00 2001
From: Pascal Zarrad
Date: Wed, 14 Jul 2021 23:11:39 +0200
Subject: [PATCH] Add erlang images
---
.github/workflows/erlang.yml | 39 ++++++++++++++++++++++++++++++++++++
erlang/22/Dockerfile | 16 +++++++++++++++
erlang/23/Dockerfile | 16 +++++++++++++++
erlang/24/Dockerfile | 16 +++++++++++++++
erlang/entrypoint.sh | 25 +++++++++++++++++++++++
5 files changed, 112 insertions(+)
create mode 100644 .github/workflows/erlang.yml
create mode 100644 erlang/22/Dockerfile
create mode 100644 erlang/23/Dockerfile
create mode 100644 erlang/24/Dockerfile
create mode 100644 erlang/entrypoint.sh
diff --git a/.github/workflows/erlang.yml b/.github/workflows/erlang.yml
new file mode 100644
index 0000000..ac22097
--- /dev/null
+++ b/.github/workflows/erlang.yml
@@ -0,0 +1,39 @@
+name: build erlang
+on:
+ schedule:
+ - cron: "0 0 * * 1"
+ push:
+ branches:
+ - master
+ paths:
+ - erlang/**
+jobs:
+ push:
+ name: "yolks:erlang_${{ matrix.tag }}"
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ tag:
+ - 22
+ - 23
+ - 24
+ steps:
+ - uses: actions/checkout@v2
+ - uses: docker/setup-buildx-action@v1
+ with:
+ version: "v0.5.1"
+ buildkitd-flags: --debug
+ - uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.REGISTRY_TOKEN }}
+ - uses: docker/build-push-action@v2
+ with:
+ context: ./erlang
+ file: ./erlang/${{ matrix.tag }}/Dockerfile
+ platforms: linux/amd64
+ push: true
+ tags: |
+ ghcr.io/pterodactyl/yolks:erlang_${{ matrix.tag }}
diff --git a/erlang/22/Dockerfile b/erlang/22/Dockerfile
new file mode 100644
index 0000000..ca64333
--- /dev/null
+++ b/erlang/22/Dockerfile
@@ -0,0 +1,16 @@
+FROM --platform=$BUILDPLATFORM erlang:22-alpine
+
+LABEL author="Pascal Zarrad" maintainer="p.zarrad@outlook.de"
+
+LABEL org.opencontainers.image.source="https://github.com/pterodactyl/yolks"
+LABEL org.opencontainers.image.licenses=MIT
+
+RUN apk add --update --no-cache ca-certificates curl git openssl sqlite tar tzdata \
+ && adduser -D -h /home/container container
+
+USER container
+ENV USER=container HOME=/home/container
+WORKDIR /home/container
+
+COPY ./../entrypoint.sh /entrypoint.sh
+CMD [ "/bin/ash", "/entrypoint.sh" ]
diff --git a/erlang/23/Dockerfile b/erlang/23/Dockerfile
new file mode 100644
index 0000000..2349293
--- /dev/null
+++ b/erlang/23/Dockerfile
@@ -0,0 +1,16 @@
+FROM --platform=$BUILDPLATFORM erlang:23-alpine
+
+LABEL author="Pascal Zarrad" maintainer="p.zarrad@outlook.de"
+
+LABEL org.opencontainers.image.source="https://github.com/pterodactyl/yolks"
+LABEL org.opencontainers.image.licenses=MIT
+
+RUN apk add --update --no-cache ca-certificates curl git openssl sqlite tar tzdata \
+ && adduser -D -h /home/container container
+
+USER container
+ENV USER=container HOME=/home/container
+WORKDIR /home/container
+
+COPY ./../entrypoint.sh /entrypoint.sh
+CMD [ "/bin/ash", "/entrypoint.sh" ]
diff --git a/erlang/24/Dockerfile b/erlang/24/Dockerfile
new file mode 100644
index 0000000..fff015f
--- /dev/null
+++ b/erlang/24/Dockerfile
@@ -0,0 +1,16 @@
+FROM --platform=$BUILDPLATFORM erlang:24-alpine
+
+LABEL author="Pascal Zarrad" maintainer="p.zarrad@outlook.de"
+
+LABEL org.opencontainers.image.source="https://github.com/pterodactyl/yolks"
+LABEL org.opencontainers.image.licenses=MIT
+
+RUN apk add --update --no-cache ca-certificates curl git openssl sqlite tar tzdata \
+ && adduser -D -h /home/container container
+
+USER container
+ENV USER=container HOME=/home/container
+WORKDIR /home/container
+
+COPY ./../entrypoint.sh /entrypoint.sh
+CMD [ "/bin/ash", "/entrypoint.sh" ]
diff --git a/erlang/entrypoint.sh b/erlang/entrypoint.sh
new file mode 100644
index 0000000..6875d24
--- /dev/null
+++ b/erlang/entrypoint.sh
@@ -0,0 +1,25 @@
+# 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
+
+# Print Erlang's version
+printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0merl -noshell -eval 'erlang:display(erlang:system_info(system_version))' -eval 'init:stop()'\n"
+erl -noshell -eval 'erlang:display(erlang:system_info(system_version))' -eval 'init:stop()'
+
+# 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}