Skip to content

Commit

Permalink
Attempt to fix timezone problems with images
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewpi committed Oct 25, 2020
1 parent 83c50f6 commit 9087c24
Show file tree
Hide file tree
Showing 20 changed files with 182 additions and 110 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
root = true

[*]
indent_style = space
indent_style = tab
indent_size = 4
tab_width = 4
end_of_line = lf
Expand All @@ -14,5 +14,6 @@ insert_final_newline = true
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2
tab_width = 2
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.DS_Store

9 changes: 2 additions & 7 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
23 changes: 18 additions & 5 deletions alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 2 additions & 7 deletions java10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
23 changes: 18 additions & 5 deletions java10/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
9 changes: 2 additions & 7 deletions java11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
23 changes: 18 additions & 5 deletions java11/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
9 changes: 2 additions & 7 deletions java12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
23 changes: 18 additions & 5 deletions java12/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
9 changes: 2 additions & 7 deletions java13/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
23 changes: 18 additions & 5 deletions java13/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
9 changes: 2 additions & 7 deletions java14/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
23 changes: 18 additions & 5 deletions java14/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
9 changes: 2 additions & 7 deletions java7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
23 changes: 18 additions & 5 deletions java7/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Loading

0 comments on commit 9087c24

Please sign in to comment.