-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (42 loc) · 2.08 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -- Build ---
FROM alpine:latest AS build
LABEL Sebas Álvaro <https://asgg.cl>
ARG MC_VERSION
RUN echo $MC_VERSION
RUN apk update && apk upgrade && apk add curl
WORKDIR /opt/minecraft
RUN rm /opt/minecraft/purpurmc.jar || true
COPY ./getpurpurserver.sh /getpurpurserver.sh
RUN chmod +x /getpurpurserver.sh && \
/getpurpurserver.sh ${MC_VERSION}
# --- Runtime ---
FROM azul/zulu-openjdk-alpine:21-jre-latest AS runtime
RUN apk update && apk upgrade && apk add curl jq
ARG TARGETARCH
ARG GOSUVERSION=1.16
ARG RCON_CLI_VER=1.6.0
RUN set -eux && \
curl -fsSL "https://github.com/tianon/gosu/releases/download/${GOSUVERSION}/gosu-${TARGETARCH}" -o /usr/bin/gosu && \
chmod +x /usr/bin/gosu && \
gosu nobody true
WORKDIR /data
COPY --from=build /opt/minecraft/purpurmc.jar /opt/minecraft/purpurmc.jar
ADD https://github.com/itzg/rcon-cli/releases/download/${RCON_CLI_VER}/rcon-cli_${RCON_CLI_VER}_linux_${TARGETARCH}.tar.gz /tmp/rcon-cli.tgz
RUN tar -x -C /usr/local/bin -f /tmp/rcon-cli.tgz rcon-cli && \
rm /tmp/rcon-cli.tgz
VOLUME "/data"
EXPOSE 25565/tcp
EXPOSE 25565/udp
ARG memory_size=1G
ENV MEMORYSIZE=$memory_size
ARG java_flags="--add-modules=jdk.incubator.vector -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"
ENV JAVAFLAGS=$java_flags
ARG papermc_flags="--nojline"
ENV PAPERMC_FLAGS=$papermc_flags
ARG purpurmc_flags="-DPurpur.IReallyDontWantSpark=true"
ENV PURPURMC_FLAGS=$purpurmc_flags
WORKDIR /data
COPY /docker-entrypoint.sh /opt/minecraft
RUN chmod +x /opt/minecraft/docker-entrypoint.sh
# Entrypoint
ENTRYPOINT ["/opt/minecraft/docker-entrypoint.sh"]