Skip to content

Commit

Permalink
refactor: Swap over to graalvm 23 image
Browse files Browse the repository at this point in the history
  • Loading branch information
0ffz committed Nov 17, 2024
1 parent 50df36c commit 717ddc7
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 27 deletions.
32 changes: 19 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
# ----------------------------------
FROM alpine as helper

Check warning on line 6 in Dockerfile

View workflow job for this annotation

GitHub Actions / Docker push for

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 6 in Dockerfile

View workflow job for this annotation

GitHub Actions / Docker push for

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
ARG KEEPUP_VERSION='3.1.1'
RUN wget -nv -q -O keepup https://github.com/MineInAbyss/Keepup/releases/download/v${KEEPUP_VERSION}/keepup
RUN wget -nv -q -O keepup https://github.com/MineInAbyss/Keepup/releases/download/v${KEEPUP_VERSION}/keepup \
&& chmod +x keepup
# Install YourKit Java Profiler agents
#RUN wget -q https://www.yourkit.com/download/docker/YourKit-JavaProfiler-2023.9-docker.zip -P /tmp/ && \
# unzip /tmp/YourKit-JavaProfiler-2023.9-docker.zip -d /usr/local && \


FROM itzg/minecraft-server:java21-graalvm as minecraft
FROM container-registry.oracle.com/graalvm/jdk:23 as minecraft

Check warning on line 14 in Dockerfile

View workflow job for this annotation

GitHub Actions / Docker push for

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 14 in Dockerfile

View workflow job for this annotation

GitHub Actions / Docker push for

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
LABEL org.opencontainers.image.authors="Offz <[email protected]>"
RUN dnf install -y ansible-core rclone wget unzip jq openssh attr
#RUN dnf install -y ansible-core rclone wget unzip jq openssh attr
RUN microdnf install --refresh -y oracle-epel-release-el9 && \
microdnf install -y ansible-core rclone wget unzip jq openssh attr file

COPY --from=helper /keepup /usr/local/bin
RUN chmod +x /usr/local/bin/keepup
ENV\
KEEPUP=true\
KEEPUP_ALLOW_OVERRIDES=true\
Expand All @@ -25,27 +27,31 @@ ENV\
SERVER_NAME=dev\
HOME=/data\
ANSIBLE_CONFIG=/server-config/ansible.cfg\
LC_ALL=C.UTF-8
LC_ALL=C.UTF-8\
UID=1000\
GID=1000

# Install ansible collections
COPY config/ansible-requirements.yml /opt/ansible/requirements.yml
RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml -p /opt/ansible/collections \
&& rm /opt/ansible/requirements.yml

# Copy over scripts
COPY scripts/dev /scripts/dev
RUN chmod +x /scripts/dev/*
COPY scripts /scripts
RUN chmod +x /scripts/*

RUN groupadd --gid 1000 minecraft && \
useradd --system --shell /bin/false --uid 1000 -g minecraft --home /data minecraft

WORKDIR $HOME
ENTRYPOINT ["/scripts/dev/entrypoint"]
ENTRYPOINT ["/scripts/entrypoint"]


FROM itzg/bungeecord as proxy

Check warning on line 50 in Dockerfile

View workflow job for this annotation

GitHub Actions / Docker push for

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 50 in Dockerfile

View workflow job for this annotation

GitHub Actions / Docker push for

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
LABEL org.opencontainers.image.authors="Offz <[email protected]>"
RUN apt-get update -y \
&& apt-get install -y rsync rclone wget unzip git pipx python3-venv jq file
COPY --from=helper /keepup /usr/local/bin
RUN chmod +x /usr/local/bin/keepup
ENV\
KEEPUP=true\
KEEPUP_ALLOW_OVERRIDES=true\
Expand All @@ -64,9 +70,9 @@ RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml -p /opt/a
&& rm /opt/ansible/requirements.yml

# Copy over scripts
COPY scripts/dev /scripts/dev
RUN chmod +x /scripts/dev/*
COPY scripts /scripts
RUN chmod +x /scripts/*

WORKDIR $HOME
RUN cp /usr/bin/run-bungeecord.sh /start
ENTRYPOINT ["/scripts/dev/entrypoint"]
ENTRYPOINT ["/scripts/entrypoint"]
File renamed without changes.
14 changes: 0 additions & 14 deletions scripts/dev/entrypoint

This file was deleted.

File renamed without changes.
14 changes: 14 additions & 0 deletions scripts/entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -e

usermod -u $UID minecraft
groupmod -o -g "$GID" minecraft

if [ "$UPDATE_DATA_OWNER" = "true" ]; then
echo "[Init] Updating owner for /data and /server-config to $UID:$GID"
chown $UID:$GID -R /data
chown $UID:$GID -R /server-config
fi

exec setpriv --reuid $UID --regid $GID --init-groups --inh-caps=-all /scripts/rootless
File renamed without changes.
14 changes: 14 additions & 0 deletions scripts/rootless
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

echo [Init] Running scripts as user: $(whoami)

. /scripts/ansible
. /scripts/keepup
. /scripts/download_server

# If /start exists
if [ -f /start ]; then
exec /start
else
exec java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar "$(basename "${CUSTOM_SERVER}")" "$@" $EXTRA_ARGS
fi

0 comments on commit 717ddc7

Please sign in to comment.