diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 5cf5bc3..4eea5a7 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -15,6 +15,7 @@ jobs: fail-fast: false matrix: tag: + - 2.7 - 3.7 - 3.8 - 3.9 diff --git a/python/2.7/Dockerfile b/python/2.7/Dockerfile new file mode 100644 index 0000000..798f58f --- /dev/null +++ b/python/2.7/Dockerfile @@ -0,0 +1,14 @@ +FROM python:2.7-slim + +LABEL author="Michael Parker" maintainer="parker@pterodactyl.io" + +RUN apt update \ + && apt -y install git gcc g++ ca-certificates dnsutils curl iproute2 ffmpeg procps \ + && useradd -m -d /home/container container + +USER container +ENV USER=container HOME=/home/container +WORKDIR /home/container + +COPY ./../entrypoint.sh /entrypoint.sh +CMD ["/bin/bash", "/entrypoint.sh"] diff --git a/python/3.7/Dockerfile b/python/3.7/Dockerfile index 2ecb0fb..c361acb 100644 --- a/python/3.7/Dockerfile +++ b/python/3.7/Dockerfile @@ -1,38 +1,14 @@ -# -# 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. -# +FROM python:3.7-slim -FROM --platform=$BUILDPLATFORM python:3.7-alpine +LABEL author="Michael Parker" maintainer="parker@pterodactyl.io" -LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" - -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 ffmpeg g++ gcc git openssl sqlite tar tzdata \ - && adduser -D -h /home/container container +RUN apt update \ + && apt -y install git gcc g++ ca-certificates dnsutils curl iproute2 ffmpeg procps \ + && useradd -m -d /home/container container USER container ENV USER=container HOME=/home/container WORKDIR /home/container COPY ./../entrypoint.sh /entrypoint.sh -CMD [ "/bin/ash", "/entrypoint.sh" ] +CMD ["/bin/bash", "/entrypoint.sh"] diff --git a/python/3.8/Dockerfile b/python/3.8/Dockerfile index 8a5696b..7168292 100644 --- a/python/3.8/Dockerfile +++ b/python/3.8/Dockerfile @@ -1,38 +1,14 @@ -# -# 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. -# +FROM python:3.8-slim -FROM --platform=$BUILDPLATFORM python:3.8-alpine +LABEL author="Michael Parker" maintainer="parker@pterodactyl.io" -LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" - -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 ffmpeg g++ gcc git openssl sqlite tar tzdata \ - && adduser -D -h /home/container container +RUN apt update \ + && apt -y install git gcc g++ ca-certificates dnsutils curl iproute2 ffmpeg procps \ + && useradd -m -d /home/container container USER container ENV USER=container HOME=/home/container WORKDIR /home/container COPY ./../entrypoint.sh /entrypoint.sh -CMD [ "/bin/ash", "/entrypoint.sh" ] +CMD ["/bin/bash", "/entrypoint.sh"] diff --git a/python/3.9/Dockerfile b/python/3.9/Dockerfile index 4c79bf4..24c1ac0 100644 --- a/python/3.9/Dockerfile +++ b/python/3.9/Dockerfile @@ -1,38 +1,14 @@ -# -# 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. -# +FROM python:3.9-slim -FROM --platform=$BUILDPLATFORM python:3.9-alpine +LABEL author="Michael Parker" maintainer="parker@pterodactyl.io" -LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" - -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 ffmpeg g++ gcc git openssl sqlite tar tzdata \ - && adduser -D -h /home/container container +RUN apt update \ + && apt -y install git gcc g++ ca-certificates dnsutils curl iproute2 ffmpeg procps \ + && useradd -m -d /home/container container USER container ENV USER=container HOME=/home/container WORKDIR /home/container COPY ./../entrypoint.sh /entrypoint.sh -CMD [ "/bin/ash", "/entrypoint.sh" ] +CMD ["/bin/bash", "/entrypoint.sh"] diff --git a/python/entrypoint.sh b/python/entrypoint.sh index 7910906..0a7b93d 100644 --- a/python/entrypoint.sh +++ b/python/entrypoint.sh @@ -1,49 +1,15 @@ -#!/bin/ash +#!/bin/bash +cd /home/container -# -# 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. -# +# Make internal Docker IP address available to processes. +export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` -# 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 Python version -printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0mpython --version\n" +# Print current Python version python --version -# 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 -)") +# Replace Startup Variables +MODIFIED_STARTUP=$(echo -e $(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')) +echo -e ":/home/container$ ${MODIFIED_STARTUP}" -# 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} +# Run the Server +eval ${MODIFIED_STARTUP}