feat: migrate Python images based on eval startup to support Discord egg

Migrates Python images from images fork with eval startup that correctly parses the Discord.py startup parameters
This commit is contained in:
Softwarenoob
2021-08-06 21:55:29 +03:00
parent d8126cc628
commit 6b1fde7b50
6 changed files with 43 additions and 134 deletions

View File

@@ -15,6 +15,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
tag: tag:
- 2.7
- 3.7 - 3.7
- 3.8 - 3.8
- 3.9 - 3.9

14
python/2.7/Dockerfile Normal file
View File

@@ -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"]

View File

@@ -1,38 +1,14 @@
# FROM python:3.7-slim
# 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 --platform=$BUILDPLATFORM python:3.7-alpine LABEL author="Michael Parker" maintainer="parker@pterodactyl.io"
LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apt update \
&& apt -y install git gcc g++ ca-certificates dnsutils curl iproute2 ffmpeg procps \
LABEL org.opencontainers.image.source="https://github.com/pterodactyl/yolks" && useradd -m -d /home/container container
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
USER container USER container
ENV USER=container HOME=/home/container ENV USER=container HOME=/home/container
WORKDIR /home/container WORKDIR /home/container
COPY ./../entrypoint.sh /entrypoint.sh COPY ./../entrypoint.sh /entrypoint.sh
CMD [ "/bin/ash", "/entrypoint.sh" ] CMD ["/bin/bash", "/entrypoint.sh"]

View File

@@ -1,38 +1,14 @@
# FROM python:3.8-slim
# 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 --platform=$BUILDPLATFORM python:3.8-alpine LABEL author="Michael Parker" maintainer="parker@pterodactyl.io"
LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apt update \
&& apt -y install git gcc g++ ca-certificates dnsutils curl iproute2 ffmpeg procps \
LABEL org.opencontainers.image.source="https://github.com/pterodactyl/yolks" && useradd -m -d /home/container container
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
USER container USER container
ENV USER=container HOME=/home/container ENV USER=container HOME=/home/container
WORKDIR /home/container WORKDIR /home/container
COPY ./../entrypoint.sh /entrypoint.sh COPY ./../entrypoint.sh /entrypoint.sh
CMD [ "/bin/ash", "/entrypoint.sh" ] CMD ["/bin/bash", "/entrypoint.sh"]

View File

@@ -1,38 +1,14 @@
# FROM python:3.9-slim
# 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 --platform=$BUILDPLATFORM python:3.9-alpine LABEL author="Michael Parker" maintainer="parker@pterodactyl.io"
LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apt update \
&& apt -y install git gcc g++ ca-certificates dnsutils curl iproute2 ffmpeg procps \
LABEL org.opencontainers.image.source="https://github.com/pterodactyl/yolks" && useradd -m -d /home/container container
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
USER container USER container
ENV USER=container HOME=/home/container ENV USER=container HOME=/home/container
WORKDIR /home/container WORKDIR /home/container
COPY ./../entrypoint.sh /entrypoint.sh COPY ./../entrypoint.sh /entrypoint.sh
CMD [ "/bin/ash", "/entrypoint.sh" ] CMD ["/bin/bash", "/entrypoint.sh"]

View File

@@ -1,49 +1,15 @@
#!/bin/ash #!/bin/bash
cd /home/container
# # Make internal Docker IP address available to processes.
# Copyright (c) 2021 Matthew Penner export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'`
#
# 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. # Print current Python version
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"
python --version python --version
# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell # Replace Startup Variables
# variable format of "${VARIABLE}" before evaluating the string and automatically MODIFIED_STARTUP=$(echo -e $(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g'))
# replacing the values. echo -e ":/home/container$ ${MODIFIED_STARTUP}"
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 # Run the Server
# from the container itself. eval ${MODIFIED_STARTUP}
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED"
# shellcheck disable=SC2086
exec env ${PARSED}