File tree Expand file tree Collapse file tree 4 files changed +31
-37
lines changed
Expand file tree Collapse file tree 4 files changed +31
-37
lines changed Original file line number Diff line number Diff line change 1- # ------- BUILD LAYER --------- #
2- FROM alpine AS build
1+ FROM amazoncorretto:21
32
43ARG mc_version
54ENV MC_VERSION=${mc_version}
65
7- RUN apk add --no-cache curl jq
8-
9- COPY --chmod=755 install-paper.sh /tmp/install-paper.sh
10- RUN /tmp/install-paper.sh
11-
12- # -------- APP LAYER ---------- #
13- FROM amazoncorretto:21
14-
156ENV PUID=1000
16- RUN yum install wget shadow-utils -y && useradd -r -u ${PUID} mc
17-
187ENV GOSU_VERSION=1.17
19- COPY --chmod=755 install-gosu.sh /tmp/install-gosu.sh
20- RUN /tmp/install-gosu.sh
21-
22- COPY --from=build --chmod=755 /tmp/server.jar /opt/minecraft/server.jar
238
249# https://docs.papermc.io/paper/aikars-flags
2510ENV JAVA_FLAGS="-Dlog4j2.formatMsgNoLookups=true -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=mcflags.emc.gs -Dcom.mojang.eula.agree=true"
2611ENV PAPERMC_FLAGS="--nojline"
2712ENV MEM_SIZE="1G"
2813
29- WORKDIR /data
14+ VOLUME /opt/minecraft/data
15+ WORKDIR /opt/minecraft/data
16+
17+ COPY --chmod=755 ./install-gosu.sh ./install-paper.sh ./docker-entrypoint.sh /usr/local/bin/
18+
19+ RUN yum install -y curl wget jq shadow-utils && \
20+ useradd -r -u ${PUID} mc && \
21+ # mkdir -p /opt/minecraft && \
22+ install-gosu.sh && \
23+ install-paper.sh
3024
31- COPY --chmod=755 docker-entrypoint.sh /docker-entrypoint.sh
32- ENTRYPOINT ["/docker-entrypoint.sh" ]
25+ ENTRYPOINT ["docker-entrypoint.sh" ]
3326CMD java -jar -Xms${MEM_SIZE} -Xmx${MEM_SIZE} ${JAVA_FLAGS} /opt/minecraft/server.jar ${PAPERMC_FLAGS} nogui
Original file line number Diff line number Diff line change 1- #! /bin/sh
2- set -eux
1+ #! /usr/ bin/env sh
2+ set -e
33
44if [ -n " ${PUID} " ] && [ ! " ${PUID} " = " $( id mc -u) " ]; then
55 usermod -o -u " $PUID " mc
66 echo " UID of mc user: $( id mc -u) "
77fi
8- chown -R mc /data
8+
9+ chown -R mc /opt/minecraft
910exec gosu mc " $@ "
Original file line number Diff line number Diff line change 1- #! /bin/sh
1+ #! /usr/ bin/env sh
22# https://github.com/tianon/gosu/blob/master/INSTALL.md
3- set -eux
3+ set -e
4+
45rpmArch=" $( rpm --query --queryformat=' %{ARCH}' rpm) " ;
56case " $rpmArch " in
67 aarch64) dpkgArch=' arm64' ;;
@@ -12,7 +13,9 @@ case "$rpmArch" in
1213 * ) echo >&2 " error: unknown/unsupported architecture '$rpmArch '" ; exit 1 ;;
1314esac ;
1415echo " $rpmArch -> $dpkgArch "
16+
1517wget -O /usr/local/bin/gosu " https://github.com/tianon/gosu/releases/download/$GOSU_VERSION /gosu-$dpkgArch " ;
1618chmod +x /usr/local/bin/gosu;
19+
1720gosu --version;
1821gosu nobody true
Original file line number Diff line number Diff line change 1- #! /bin/sh
2- # https://docs.papermc.io/misc/downloads-api
3- set -eux
1+ #! /usr/bin/env sh
2+ set -e
43
5- # get latest mc version if env var is not set
4+ # https://docs.papermc.io/misc/downloads-api
65: " ${MC_VERSION:= $(curl -s ' https://api.papermc.io/v2/projects/paper' | jq -r ' .versions[-1]' )} "
6+ : " ${BUILD:= $(curl -s " https://api.papermc.io/v2/projects/paper/versions/${MC_VERSION} /builds" | jq -r ' .builds | map(select(.channel == "default") | .build) | .[-1]' )} "
77
8- # get latest stable build for mc version
9- LATEST_BUILD=$( curl -s " https://api.papermc.io/v2/projects/paper/versions/${MC_VERSION} /builds" | \
10- jq -r ' .builds | map(select(.channel == "default") | .build) | .[-1]' )
11-
12- if [ " $LATEST_BUILD " != " null" ]; then
13- JAR_NAME=" paper-${MC_VERSION} -${LATEST_BUILD} .jar"
14- PAPERMC_URL=" https://api.papermc.io/v2/projects/paper/versions/${MC_VERSION} /builds/${LATEST_BUILD} /downloads/${JAR_NAME} "
15- curl -o /tmp/server.jar " $PAPERMC_URL "
8+ if [ " $BUILD " != " null" ]; then
9+ JAR_NAME=" paper-${MC_VERSION} -${BUILD} .jar"
10+ PAPERMC_URL=" https://api.papermc.io/v2/projects/paper/versions/${MC_VERSION} /builds/${BUILD} /downloads/${JAR_NAME} "
11+ echo " $PAPERMC_URL "
12+ curl -o /opt/minecraft/server.jar " $PAPERMC_URL "
1613else
1714 echo " No stable build for version ${MC_VERSION} found!"
1815 exit 1
19- fi
16+ fi
You can’t perform that action at this time.
0 commit comments