-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
124 lines (100 loc) · 3.43 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
ARG JAVA_VERSION=21
FROM docker.io/library/ubuntu:noble AS mcrcon
ARG MCRCON_VERSION="0.7.2"
RUN apt-get update \
&& apt-get install -y build-essential git
RUN cd /tmp \
&& git clone -b "v${MCRCON_VERSION}" --depth=1 https://github.com/Tiiffi/mcrcon . \
&& make \
&& mv mcrcon /
FROM docker.io/library/eclipse-temurin:${JAVA_VERSION}-jdk-jammy
ENV MINECRAFT_DIR="/minecraft"
RUN addgroup --gid 1000 "minecraft" && adduser --uid 1000 --disabled-password --ingroup "minecraft" --home "${MINECRAFT_DIR}" "minecraft"
ENV SPONGE_JAR="${MINECRAFT_DIR}/sponge.jar" \
MINECRAFT_MODS_DIR="${MINECRAFT_DIR}/mods" \
MINECRAFT_PLUGINS_DIR="${MINECRAFT_DIR}/plugins" \
MINECRAFT_CONFIG_DIR="${MINECRAFT_DIR}/config" \
MINECRAFT_WORLD_DIR="${MINECRAFT_DIR}/world" \
MINECRAFT_LOGS_DIR="${MINECRAFT_DIR}/logs" \
MINECRAFT_ROOT_STUFF_DIR="${MINECRAFT_DIR}/root"
# bash: easy scripting
# curl: sponge download and nice to have
# gettext: envsubst
RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests curl bash gettext jq \
&& apt-get clean
ARG ASYNC_PROFILER_VERSION=2.9
RUN curl -sLo /tmp/profiler.tar.gz "https://github.com/jvm-profiling-tools/async-profiler/releases/download/v${ASYNC_PROFILER_VERSION}/async-profiler-${ASYNC_PROFILER_VERSION}-linux-x64.tar.gz" \
&& tar -xf /tmp/profiler.tar.gz -C /opt \
&& rm /tmp/profiler.tar.gz \
&& mv /opt/async-profiler* /opt/async-profiler \
&& ln -s /opt/async-profiler/profiler.sh /usr/local/bin/async-profiler
COPY --from=mcrcon --chmod=755 /mcrcon /opt/mcrcon
COPY mcrcon.sh /usr/local/bin/mcrcon
COPY log4j2.xml /
COPY launcher.conf.template /
USER "minecraft:minecraft"
WORKDIR ${MINECRAFT_DIR}
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["--nogui"]
EXPOSE 25565/tcp 25575/tcp
VOLUME ["${MINECRAFT_DIR}"]
ENV JVM_ARGS=""
ENV LAUNCHER_JVM_ARGS=""
ENV DB_CONNECTION_STRING="jdbc:postgresql://user:password@localhost:5432/minecraft" \
DB_ALIAS="database"
ENV OPS=""
# The next env variables control the server.properties file. Have a look at the documentation of the file to get the meaning.
ENV ALLOW_FLIGHT=false \
ALLOW_NETHER=true \
BROADCAST_CONSOLE_TO_OPS=true \
BROADCAST_RCON_TO_OPS=true \
DIFFICULTY=easy \
ENABLE_COMMAND_BLOCK=false \
ENABLE_JMX_MONITORING=false \
ENABLE_QUERY=false \
ENABLE_RCON=false \
ENABLE_STATUS=true \
ENFORCE_WHITELIST=false \
ENTITY_BROADCAST_RANGE_PERCENTAGE=100 \
FORCE_GAMEMODE=false \
FUNCTION_PERMISSION_LEVEL=2 \
GAMEMODE=survival \
GENERATE_STRUCTURES=true \
GENERATOR_SETTINGS="" \
HARDCORE=false \
LEVEL_NAME=world \
LEVEL_SEED="" \
LEVEL_TYPE=default \
MAX_BUILD_HEIGHT=256 \
MAX_PLAYERS=20 \
MAX_TICK_TIME=60000 \
MAX_WORLD_SIZE=29999984 \
MOTD="A Minecraft Server" \
NETWORK_COMPRESSION_THRESHOLD=256 \
ONLINE_MODE=true \
OP_PERMISSION_LEVEL=4 \
PLAYER_IDLE_TIMEOUT=0 \
PREVENT_PROXY_CONNECTIONS=false \
PVP=true \
QUERY_PORT=25565 \
RATE_LIMIT=0 \
RCON_PASSWORD="" \
RCON_PORT=25575 \
RESOURCE_PACK_SHA1="" \
RESOURCE_PACK="" \
SERVER_IP="" \
SERVER_PORT=25565 \
SNOOPER_ENABLED=true \
SPAWN_ANIMALS=true \
SPAWN_MONSTERS=true \
SPAWN_NPCS=true \
SPAWN_PROTECTION=16 \
SYNC_CHUNK_WRITES=true \
TEXT_FILTERING_CONFIG="" \
USE_NATIVE_TRANSPORT=true \
VIEW_DISTANCE=10 \
WHITE_LIST=false
STOPSIGNAL INT
COPY sponge.jar /sponge.jar