From 9087c245bc2886e663ca6c929d6e4f1e0269392c Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sun, 25 Oct 2020 11:23:45 -0600 Subject: [PATCH] Attempt to fix timezone problems with images --- .editorconfig | 3 ++- .gitignore | 1 - alpine/Dockerfile | 9 ++------- alpine/entrypoint.sh | 23 ++++++++++++++++++----- java10/Dockerfile | 9 ++------- java10/entrypoint.sh | 23 ++++++++++++++++++----- java11/Dockerfile | 9 ++------- java11/entrypoint.sh | 23 ++++++++++++++++++----- java12/Dockerfile | 9 ++------- java12/entrypoint.sh | 23 ++++++++++++++++++----- java13/Dockerfile | 9 ++------- java13/entrypoint.sh | 23 ++++++++++++++++++----- java14/Dockerfile | 9 ++------- java14/entrypoint.sh | 23 ++++++++++++++++++----- java7/Dockerfile | 9 ++------- java7/entrypoint.sh | 23 ++++++++++++++++++----- java8/Dockerfile | 9 ++------- java8/entrypoint.sh | 23 ++++++++++++++++++----- java9/Dockerfile | 9 ++------- java9/entrypoint.sh | 23 ++++++++++++++++++----- 20 files changed, 182 insertions(+), 110 deletions(-) diff --git a/.editorconfig b/.editorconfig index a884581..9a64098 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ root = true [*] -indent_style = space +indent_style = tab indent_size = 4 tab_width = 4 end_of_line = lf @@ -14,5 +14,6 @@ insert_final_newline = true trim_trailing_whitespace = false [*.yml] +indent_style = space indent_size = 2 tab_width = 2 diff --git a/.gitignore b/.gitignore index 5ca0973..e43b0f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ .DS_Store - diff --git a/alpine/Dockerfile b/alpine/Dockerfile index d216771..846b0c1 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -7,15 +7,10 @@ FROM alpine:latest -LABEL author="Matthew Penner" maintainer="me@matthewp.io" +LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apk add --update --no-cache ca-certificates tzdata \ - && adduser -D -h /home/container container \ - && ln -s /etc/localtime /etc/timezone - -USER container -ENV USER=container HOME=/home/container -WORKDIR /home/container + && adduser -D -h /home/container container COPY ./entrypoint.sh /entrypoint.sh CMD [ "/bin/ash", "/entrypoint.sh" ] diff --git a/alpine/entrypoint.sh b/alpine/entrypoint.sh index b0841d8..02e16ae 100644 --- a/alpine/entrypoint.sh +++ b/alpine/entrypoint.sh @@ -7,14 +7,27 @@ # https://github.com/matthewpi/images/blob/master/LICENSE.md # +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set the timezone in the container +echo $TZ > /etc/timezone +ln -s ../usr/share/zoneinfo/$TZ /etc/localtime + +# Switch to the container's working directory +USER=container +HOME=/home/container +export USER +export HOME cd /home/container # Set environment variable that holds the Internal Docker IP export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` -# Replace start command variables -MODIFIED_START=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` -echo "[container@pterodactyl ~]$ ${MODIFIED_START}" +# Replace variables in the startup command +MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +echo "[container@pterodactyl ~]$ ${MODIFIED_STARTUP}" -# Run the modified start command -eval ${MODIFIED_START} +# Run the startup command +su -c "eval ${MODIFIED_STARTUP}" container diff --git a/java10/Dockerfile b/java10/Dockerfile index 249bdf2..be84308 100644 --- a/java10/Dockerfile +++ b/java10/Dockerfile @@ -7,15 +7,10 @@ FROM adoptopenjdk/openjdk10-openj9:alpine -LABEL author="Matthew Penner" maintainer="me@matthewp.io" +LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apk add --update --no-cache curl ca-certificates openssl git tar bash sqlite fontconfig tzdata \ - && adduser -D -h /home/container container \ - && ln -s /etc/localtime /etc/timezone - -USER container -ENV USER=container HOME=/home/container -WORKDIR /home/container + && adduser -D -h /home/container container COPY ./entrypoint.sh /entrypoint.sh CMD [ "/bin/ash", "/entrypoint.sh" ] diff --git a/java10/entrypoint.sh b/java10/entrypoint.sh index ffd76d9..7bd8e66 100644 --- a/java10/entrypoint.sh +++ b/java10/entrypoint.sh @@ -7,6 +7,19 @@ # https://github.com/matthewpi/images/blob/master/LICENSE.md # +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set the timezone in the container +echo $TZ > /etc/timezone +ln -s ../usr/share/zoneinfo/$TZ /etc/localtime + +# Switch to the container's working directory +USER=container +HOME=/home/container +export USER +export HOME cd /home/container # Set environment variable that holds the Internal Docker IP @@ -15,9 +28,9 @@ export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` # Print Java version java -version -# Replace start command variables -MODIFIED_START=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` -echo "[container@pterodactyl ~]$ ${MODIFIED_START}" +# Replace variables in the startup command +MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +echo "[container@pterodactyl ~]$ ${MODIFIED_STARTUP}" -# Run the modified start command -eval ${MODIFIED_START} +# Run the startup command +su -c "eval ${MODIFIED_STARTUP}" container diff --git a/java11/Dockerfile b/java11/Dockerfile index f29f193..cf4da1e 100644 --- a/java11/Dockerfile +++ b/java11/Dockerfile @@ -7,15 +7,10 @@ FROM adoptopenjdk/openjdk11-openj9:alpine -LABEL author="Matthew Penner" maintainer="me@matthewp.io" +LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apk add --update --no-cache curl ca-certificates openssl git tar bash sqlite fontconfig tzdata \ - && adduser -D -h /home/container container \ - && ln -s /etc/localtime /etc/timezone - -USER container -ENV USER=container HOME=/home/container -WORKDIR /home/container + && adduser -D -h /home/container container COPY ./entrypoint.sh /entrypoint.sh CMD [ "/bin/ash", "/entrypoint.sh" ] diff --git a/java11/entrypoint.sh b/java11/entrypoint.sh index ffd76d9..7bd8e66 100644 --- a/java11/entrypoint.sh +++ b/java11/entrypoint.sh @@ -7,6 +7,19 @@ # https://github.com/matthewpi/images/blob/master/LICENSE.md # +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set the timezone in the container +echo $TZ > /etc/timezone +ln -s ../usr/share/zoneinfo/$TZ /etc/localtime + +# Switch to the container's working directory +USER=container +HOME=/home/container +export USER +export HOME cd /home/container # Set environment variable that holds the Internal Docker IP @@ -15,9 +28,9 @@ export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` # Print Java version java -version -# Replace start command variables -MODIFIED_START=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` -echo "[container@pterodactyl ~]$ ${MODIFIED_START}" +# Replace variables in the startup command +MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +echo "[container@pterodactyl ~]$ ${MODIFIED_STARTUP}" -# Run the modified start command -eval ${MODIFIED_START} +# Run the startup command +su -c "eval ${MODIFIED_STARTUP}" container diff --git a/java12/Dockerfile b/java12/Dockerfile index 17ddad9..78c9ae4 100644 --- a/java12/Dockerfile +++ b/java12/Dockerfile @@ -7,15 +7,10 @@ FROM adoptopenjdk/openjdk12-openj9:alpine -LABEL author="Matthew Penner" maintainer="me@matthewp.io" +LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apk add --update --no-cache curl ca-certificates openssl git tar bash sqlite fontconfig tzdata \ - && adduser -D -h /home/container container \ - && ln -s /etc/localtime /etc/timezone - -USER container -ENV USER=container HOME=/home/container -WORKDIR /home/container + && adduser -D -h /home/container container COPY ./entrypoint.sh /entrypoint.sh CMD [ "/bin/ash", "/entrypoint.sh" ] diff --git a/java12/entrypoint.sh b/java12/entrypoint.sh index ffd76d9..7bd8e66 100644 --- a/java12/entrypoint.sh +++ b/java12/entrypoint.sh @@ -7,6 +7,19 @@ # https://github.com/matthewpi/images/blob/master/LICENSE.md # +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set the timezone in the container +echo $TZ > /etc/timezone +ln -s ../usr/share/zoneinfo/$TZ /etc/localtime + +# Switch to the container's working directory +USER=container +HOME=/home/container +export USER +export HOME cd /home/container # Set environment variable that holds the Internal Docker IP @@ -15,9 +28,9 @@ export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` # Print Java version java -version -# Replace start command variables -MODIFIED_START=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` -echo "[container@pterodactyl ~]$ ${MODIFIED_START}" +# Replace variables in the startup command +MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +echo "[container@pterodactyl ~]$ ${MODIFIED_STARTUP}" -# Run the modified start command -eval ${MODIFIED_START} +# Run the startup command +su -c "eval ${MODIFIED_STARTUP}" container diff --git a/java13/Dockerfile b/java13/Dockerfile index 8c2fbaa..c1a3a76 100644 --- a/java13/Dockerfile +++ b/java13/Dockerfile @@ -7,15 +7,10 @@ FROM adoptopenjdk/openjdk13-openj9:alpine -LABEL author="Matthew Penner" maintainer="me@matthewp.io" +LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apk add --update --no-cache curl ca-certificates openssl git tar bash sqlite fontconfig tzdata \ - && adduser -D -h /home/container container \ - && ln -s /etc/localtime /etc/timezone - -USER container -ENV USER=container HOME=/home/container -WORKDIR /home/container + && adduser -D -h /home/container container COPY ./entrypoint.sh /entrypoint.sh CMD [ "/bin/ash", "/entrypoint.sh" ] diff --git a/java13/entrypoint.sh b/java13/entrypoint.sh index ffd76d9..7bd8e66 100644 --- a/java13/entrypoint.sh +++ b/java13/entrypoint.sh @@ -7,6 +7,19 @@ # https://github.com/matthewpi/images/blob/master/LICENSE.md # +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set the timezone in the container +echo $TZ > /etc/timezone +ln -s ../usr/share/zoneinfo/$TZ /etc/localtime + +# Switch to the container's working directory +USER=container +HOME=/home/container +export USER +export HOME cd /home/container # Set environment variable that holds the Internal Docker IP @@ -15,9 +28,9 @@ export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` # Print Java version java -version -# Replace start command variables -MODIFIED_START=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` -echo "[container@pterodactyl ~]$ ${MODIFIED_START}" +# Replace variables in the startup command +MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +echo "[container@pterodactyl ~]$ ${MODIFIED_STARTUP}" -# Run the modified start command -eval ${MODIFIED_START} +# Run the startup command +su -c "eval ${MODIFIED_STARTUP}" container diff --git a/java14/Dockerfile b/java14/Dockerfile index 816caac..39c97b5 100644 --- a/java14/Dockerfile +++ b/java14/Dockerfile @@ -7,15 +7,10 @@ FROM adoptopenjdk/openjdk14-openj9:alpine -LABEL author="Matthew Penner" maintainer="me@matthewp.io" +LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apk add --update --no-cache curl ca-certificates openssl git tar bash sqlite fontconfig tzdata \ - && adduser -D -h /home/container container \ - && ln -s /etc/localtime /etc/timezone - -USER container -ENV USER=container HOME=/home/container -WORKDIR /home/container + && adduser -D -h /home/container container COPY ./entrypoint.sh /entrypoint.sh CMD [ "/bin/ash", "/entrypoint.sh" ] diff --git a/java14/entrypoint.sh b/java14/entrypoint.sh index ffd76d9..7bd8e66 100644 --- a/java14/entrypoint.sh +++ b/java14/entrypoint.sh @@ -7,6 +7,19 @@ # https://github.com/matthewpi/images/blob/master/LICENSE.md # +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set the timezone in the container +echo $TZ > /etc/timezone +ln -s ../usr/share/zoneinfo/$TZ /etc/localtime + +# Switch to the container's working directory +USER=container +HOME=/home/container +export USER +export HOME cd /home/container # Set environment variable that holds the Internal Docker IP @@ -15,9 +28,9 @@ export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` # Print Java version java -version -# Replace start command variables -MODIFIED_START=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` -echo "[container@pterodactyl ~]$ ${MODIFIED_START}" +# Replace variables in the startup command +MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +echo "[container@pterodactyl ~]$ ${MODIFIED_STARTUP}" -# Run the modified start command -eval ${MODIFIED_START} +# Run the startup command +su -c "eval ${MODIFIED_STARTUP}" container diff --git a/java7/Dockerfile b/java7/Dockerfile index 333729a..4404de1 100644 --- a/java7/Dockerfile +++ b/java7/Dockerfile @@ -7,15 +7,10 @@ FROM openjdk:7-jre-alpine -LABEL author="Matthew Penner" maintainer="me@matthewp.io" +LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apk add --update --no-cache curl ca-certificates openssl git tar bash sqlite fontconfig tzdata \ - && adduser -D -h /home/container container \ - && ln -s /etc/localtime /etc/timezone - -USER container -ENV USER=container HOME=/home/container -WORKDIR /home/container + && adduser -D -h /home/container container COPY ./entrypoint.sh /entrypoint.sh CMD [ "/bin/ash", "/entrypoint.sh" ] diff --git a/java7/entrypoint.sh b/java7/entrypoint.sh index ffd76d9..7bd8e66 100644 --- a/java7/entrypoint.sh +++ b/java7/entrypoint.sh @@ -7,6 +7,19 @@ # https://github.com/matthewpi/images/blob/master/LICENSE.md # +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set the timezone in the container +echo $TZ > /etc/timezone +ln -s ../usr/share/zoneinfo/$TZ /etc/localtime + +# Switch to the container's working directory +USER=container +HOME=/home/container +export USER +export HOME cd /home/container # Set environment variable that holds the Internal Docker IP @@ -15,9 +28,9 @@ export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` # Print Java version java -version -# Replace start command variables -MODIFIED_START=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` -echo "[container@pterodactyl ~]$ ${MODIFIED_START}" +# Replace variables in the startup command +MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +echo "[container@pterodactyl ~]$ ${MODIFIED_STARTUP}" -# Run the modified start command -eval ${MODIFIED_START} +# Run the startup command +su -c "eval ${MODIFIED_STARTUP}" container diff --git a/java8/Dockerfile b/java8/Dockerfile index 7c8e5b1..4869521 100644 --- a/java8/Dockerfile +++ b/java8/Dockerfile @@ -7,15 +7,10 @@ FROM ibmjava:8-jre-alpine -LABEL author="Matthew Penner" maintainer="me@matthewp.io" +LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apk add --update --no-cache curl ca-certificates openssl git tar bash sqlite fontconfig tzdata \ - && adduser -D -h /home/container container \ - && ln -s /etc/localtime /etc/timezone - -USER container -ENV USER=container HOME=/home/container -WORKDIR /home/container + && adduser -D -h /home/container container COPY ./entrypoint.sh /entrypoint.sh CMD [ "/bin/ash", "/entrypoint.sh" ] diff --git a/java8/entrypoint.sh b/java8/entrypoint.sh index ffd76d9..7bd8e66 100644 --- a/java8/entrypoint.sh +++ b/java8/entrypoint.sh @@ -7,6 +7,19 @@ # https://github.com/matthewpi/images/blob/master/LICENSE.md # +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set the timezone in the container +echo $TZ > /etc/timezone +ln -s ../usr/share/zoneinfo/$TZ /etc/localtime + +# Switch to the container's working directory +USER=container +HOME=/home/container +export USER +export HOME cd /home/container # Set environment variable that holds the Internal Docker IP @@ -15,9 +28,9 @@ export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` # Print Java version java -version -# Replace start command variables -MODIFIED_START=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` -echo "[container@pterodactyl ~]$ ${MODIFIED_START}" +# Replace variables in the startup command +MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +echo "[container@pterodactyl ~]$ ${MODIFIED_STARTUP}" -# Run the modified start command -eval ${MODIFIED_START} +# Run the startup command +su -c "eval ${MODIFIED_STARTUP}" container diff --git a/java9/Dockerfile b/java9/Dockerfile index 78a656e..402fabf 100644 --- a/java9/Dockerfile +++ b/java9/Dockerfile @@ -7,15 +7,10 @@ FROM adoptopenjdk/openjdk9-openj9:alpine -LABEL author="Matthew Penner" maintainer="me@matthewp.io" +LABEL author="Matthew Penner" maintainer="matthew@pterodactyl.io" RUN apk add --update --no-cache curl ca-certificates openssl git tar bash sqlite fontconfig tzdata \ - && adduser -D -h /home/container container \ - && ln -s /etc/localtime /etc/timezone - -USER container -ENV USER=container HOME=/home/container -WORKDIR /home/container + && adduser -D -h /home/container container COPY ./entrypoint.sh /entrypoint.sh CMD [ "/bin/ash", "/entrypoint.sh" ] diff --git a/java9/entrypoint.sh b/java9/entrypoint.sh index ffd76d9..7bd8e66 100644 --- a/java9/entrypoint.sh +++ b/java9/entrypoint.sh @@ -7,6 +7,19 @@ # https://github.com/matthewpi/images/blob/master/LICENSE.md # +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set the timezone in the container +echo $TZ > /etc/timezone +ln -s ../usr/share/zoneinfo/$TZ /etc/localtime + +# Switch to the container's working directory +USER=container +HOME=/home/container +export USER +export HOME cd /home/container # Set environment variable that holds the Internal Docker IP @@ -15,9 +28,9 @@ export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'` # Print Java version java -version -# Replace start command variables -MODIFIED_START=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` -echo "[container@pterodactyl ~]$ ${MODIFIED_START}" +# Replace variables in the startup command +MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +echo "[container@pterodactyl ~]$ ${MODIFIED_STARTUP}" -# Run the modified start command -eval ${MODIFIED_START} +# Run the startup command +su -c "eval ${MODIFIED_STARTUP}" container