-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
65 lines (48 loc) · 2.41 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
60
61
62
63
64
65
########################################################
############## We use a java base image ################
########################################################
FROM eclipse-temurin:17-jre-focal AS build
RUN apt-get update; \
apt-get install -y curl jq;
LABEL Marc Tönsing <marc@marc.tv>, Nico Enking <nico.enking@gmail.com>
ARG version=1.18.2
########################################################
############## Download Paper with API #################
########################################################
WORKDIR /opt/minecraft
COPY ./getpaperserver.sh /
RUN chmod +x /getpaperserver.sh
RUN /getpaperserver.sh ${version}
# Run paperclip and obtain patched jar
RUN java -Dpaperclip.patchonly=true -jar /opt/minecraft/paperclip.jar; exit 0
########################################################
############## Running environment #####################
########################################################
FROM eclipse-temurin:17-jre-focal AS runtime
RUN apt-get update; \
apt-get install -y gosu;
# Working directory
WORKDIR /data
# Obtain runable jar from build stage
COPY --from=build /opt/minecraft/paperclip.jar /opt/minecraft/paperspigot.jar
# Install and run rcon
ARG RCON_CLI_VER=1.4.8
ADD https://github.com/itzg/rcon-cli/releases/download/${RCON_CLI_VER}/rcon-cli_${RCON_CLI_VER}_linux_amd64.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
# Volumes for the external data (Server, World, Config...)
VOLUME "/data"
# Expose minecraft port
EXPOSE 25565/tcp
EXPOSE 25565/udp
# Set memory size
ARG memory_size=3G
ENV MEMORYSIZE=$memory_size
# Set Java Flags
ARG 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"
ENV JAVAFLAGS=$java_flags
WORKDIR /data
COPY /docker-entrypoint.sh /opt/minecraft
RUN chmod +x /opt/minecraft/docker-entrypoint.sh
# Entrypoint
ENTRYPOINT ["/opt/minecraft/docker-entrypoint.sh"]