mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-18 07:26:24 +00:00
Compare commits
27 Commits
2021.7.0-j
...
2021.9.0-j
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49f9ff645e | ||
|
|
70ea32e89d | ||
|
|
004cbdb9f7 | ||
|
|
52cbf1fb64 | ||
|
|
190e401452 | ||
|
|
b881a27c8d | ||
|
|
45856a1a81 | ||
|
|
1e615e76e8 | ||
|
|
1c85a685de | ||
|
|
7cd207f40b | ||
|
|
140a8aa90c | ||
|
|
76dcff9d18 | ||
|
|
a9a86d249b | ||
|
|
595760d301 | ||
|
|
6d3f194ce3 | ||
|
|
21c1620f0c | ||
|
|
e78e5af96d | ||
|
|
a2ab0d75ed | ||
|
|
0fb9700fc7 | ||
|
|
18925ef32c | ||
|
|
f06b990f8a | ||
|
|
75844ae81a | ||
|
|
6bb2323c46 | ||
|
|
7814ca21b5 | ||
|
|
b8806629ec | ||
|
|
4a7f838a0f | ||
|
|
2d07dee4df |
@@ -1,10 +1,7 @@
|
|||||||
FROM adoptopenjdk/openjdk11:alpine-jre
|
FROM openjdk:8u212-jre-alpine
|
||||||
|
|
||||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||||
|
|
||||||
# upgrade all packages since alpine jre8 base image tops out at 8u212
|
|
||||||
RUN apk -U --no-cache upgrade
|
|
||||||
|
|
||||||
RUN apk add --no-cache -U \
|
RUN apk add --no-cache -U \
|
||||||
openssl \
|
openssl \
|
||||||
imagemagick \
|
imagemagick \
|
||||||
@@ -69,6 +66,8 @@ COPY server.properties /tmp/server.properties
|
|||||||
COPY log4j2.xml /tmp/log4j2.xml
|
COPY log4j2.xml /tmp/log4j2.xml
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
|
STOPSIGNAL SIGTERM
|
||||||
|
|
||||||
ENV UID=1000 GID=1000 \
|
ENV UID=1000 GID=1000 \
|
||||||
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST \
|
TYPE=VANILLA VERSION=LATEST \
|
||||||
|
|||||||
47
README.md
47
README.md
@@ -317,9 +317,23 @@ A [Tuinity](https://github.com/Spottedleaf/Tuinity) server, which is a fork of P
|
|||||||
|
|
||||||
> **NOTE** only `VERSION=LATEST` is supported
|
> **NOTE** only `VERSION=LATEST` is supported
|
||||||
|
|
||||||
|
## Running an Airplane server
|
||||||
|
|
||||||
|
An [Airplane](https://github.com/TECHNOVE/Airplane) server, which is a fork of Tuinity aimed at further improving server performance at high playercounts.
|
||||||
|
|
||||||
|
-e TYPE=AIRPLANE
|
||||||
|
|
||||||
|
> **NOTE** only `VERSION=LATEST` is supported
|
||||||
|
|
||||||
|
> **NOTE** only Java 8 and 11 are supported
|
||||||
|
|
||||||
|
Extra variables:
|
||||||
|
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||||
|
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
|
||||||
|
|
||||||
## Running a Purpur server
|
## Running a Purpur server
|
||||||
|
|
||||||
A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper and Tuinity with the goal of providing new and interesting configuration options".
|
A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper, Tuinity, Airplane with the goal of providing new and interesting configuration options".
|
||||||
|
|
||||||
-e TYPE=PURPUR
|
-e TYPE=PURPUR
|
||||||
|
|
||||||
@@ -328,6 +342,7 @@ A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper and Tuini
|
|||||||
Extra variables:
|
Extra variables:
|
||||||
- `PURPUR_BUILD=LATEST` : set a specific Purpur build to use
|
- `PURPUR_BUILD=LATEST` : set a specific Purpur build to use
|
||||||
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||||
|
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
|
||||||
|
|
||||||
## Running a Yatopia server
|
## Running a Yatopia server
|
||||||
|
|
||||||
@@ -340,6 +355,7 @@ A [Yatopia](https://github.com/YatopiaMC/Yatopia) server, which is a "blazing fa
|
|||||||
Extra variables:
|
Extra variables:
|
||||||
- `RELEASE=stable` : set to `stable` or `latest`
|
- `RELEASE=stable` : set to `stable` or `latest`
|
||||||
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||||
|
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
|
||||||
|
|
||||||
## Running a Magma server
|
## Running a Magma server
|
||||||
|
|
||||||
@@ -1097,6 +1113,35 @@ via a `JVM_XX_OPTS` environment variable.
|
|||||||
For some cases, if e.g. after removing mods, it could be necessary to startup minecraft with an additional `-D` parameter like `-Dfml.queryResult=confirm`. To address this you can use the environment variable `JVM_DD_OPTS`, which builds the params from a given list of values separated by space, but without the `-D` prefix. To make things running under systems (e.g. Plesk), which doesn't allow `=` inside values, a `:` (colon) could be used instead. The upper example would look like this:
|
For some cases, if e.g. after removing mods, it could be necessary to startup minecraft with an additional `-D` parameter like `-Dfml.queryResult=confirm`. To address this you can use the environment variable `JVM_DD_OPTS`, which builds the params from a given list of values separated by space, but without the `-D` prefix. To make things running under systems (e.g. Plesk), which doesn't allow `=` inside values, a `:` (colon) could be used instead. The upper example would look like this:
|
||||||
`JVM_DD_OPTS=fml.queryResult:confirm`, and will be converted to `-Dfml.queryResult=confirm`.
|
`JVM_DD_OPTS=fml.queryResult:confirm`, and will be converted to `-Dfml.queryResult=confirm`.
|
||||||
|
|
||||||
|
### Interactive and Color Console
|
||||||
|
|
||||||
|
If you would like to attach to the Minecraft server console with color and interactive capabilities, then add
|
||||||
|
|
||||||
|
```
|
||||||
|
-e EXEC_DIRECTLY=true
|
||||||
|
```
|
||||||
|
|
||||||
|
> **NOTE** this will bypass graceful server shutdown handling when using `docker stop`, so be sure to use `rcon-cli` or console commands to `stop` the server.
|
||||||
|
|
||||||
|
### OpenJ9 Specific Options
|
||||||
|
|
||||||
|
The openj9 image tags include specific variables to simplify configuration:
|
||||||
|
|
||||||
|
- `-e TUNE_VIRTUALIZED=TRUE` : enables the option to
|
||||||
|
[optimize for virtualized environments](https://www.eclipse.org/openj9/docs/xtunevirtualized/)
|
||||||
|
- `-e TUNE_NURSERY_SIZES=TRUE` : configures nursery sizes where the initial size is 50%
|
||||||
|
of the `MAX_MEMORY` and the max size is 80%.
|
||||||
|
|
||||||
|
### Enabling rolling logs
|
||||||
|
|
||||||
|
By default the vanilla log file will grow without limit. The logger can be reconfigured to use a rolling log files strategy by using:
|
||||||
|
|
||||||
|
```
|
||||||
|
-e ENABLE_ROLLING_LOGS=true
|
||||||
|
```
|
||||||
|
|
||||||
|
> **NOTE** this will interfere with interactive/color consoles [as described in the section above](#interactive-and-color-console)
|
||||||
|
|
||||||
## Timezone Configuration
|
## Timezone Configuration
|
||||||
|
|
||||||
You can configure the timezone to match yours by setting the `TZ` environment variable:
|
You can configure the timezone to match yours by setting the `TZ` environment variable:
|
||||||
|
|||||||
2
start
2
start
@@ -5,7 +5,7 @@
|
|||||||
umask 0002
|
umask 0002
|
||||||
chmod g+w /data
|
chmod g+w /data
|
||||||
|
|
||||||
if [ $(id -u) = 0 ]; then
|
if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then
|
||||||
runAsUser=minecraft
|
runAsUser=minecraft
|
||||||
runAsGroup=minecraft
|
runAsGroup=minecraft
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ fi
|
|||||||
|
|
||||||
if ! which java > /dev/null; then
|
if ! which java > /dev/null; then
|
||||||
log "Fixing PATH to include java"
|
log "Fixing PATH to include java"
|
||||||
PATH="${PATH}:/opt/java/openjdk/bin"
|
PATH="${PATH}:/usr/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
||||||
@@ -105,12 +105,6 @@ case "${TYPE^^}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
FORGE)
|
FORGE)
|
||||||
log "**********************************************************************"
|
|
||||||
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
|
|
||||||
log " since some mods require Java 8"
|
|
||||||
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
|
|
||||||
log " can be fixed with java8"
|
|
||||||
log "**********************************************************************"
|
|
||||||
exec ${SCRIPTS:-/}start-deployForge "$@"
|
exec ${SCRIPTS:-/}start-deployForge "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -119,12 +113,6 @@ case "${TYPE^^}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
FTB|CURSEFORGE)
|
FTB|CURSEFORGE)
|
||||||
log "**********************************************************************"
|
|
||||||
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
|
|
||||||
log " since some mods require Java 8"
|
|
||||||
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
|
|
||||||
log " can be fixed with java8"
|
|
||||||
log "**********************************************************************"
|
|
||||||
exec ${SCRIPTS:-/}start-deployCF "$@"
|
exec ${SCRIPTS:-/}start-deployCF "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -163,12 +151,16 @@ case "${TYPE^^}" in
|
|||||||
YATOPIA)
|
YATOPIA)
|
||||||
exec ${SCRIPTS:-/}start-deployYatopia "$@"
|
exec ${SCRIPTS:-/}start-deployYatopia "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
AIRPLANE)
|
||||||
|
exec ${SCRIPTS:-/}start-deployAirplane "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
log "Invalid type: '$TYPE'"
|
log "Invalid type: '$TYPE'"
|
||||||
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
||||||
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, TUINITY, PURPUR"
|
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, TUINITY, PURPUR"
|
||||||
log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA"
|
log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA, AIRPLANE"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
37
start-deployAirplane
Normal file
37
start-deployAirplane
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
|
JAVA_VER=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
|
||||||
|
|
||||||
|
if [ "${JAVA_VER}" != "8" ] && [ "${JAVA_VER}" != "11" ]; then
|
||||||
|
log "ERROR: Airplane server type only supports Java versions 8 and 11"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${VERSION}" != "LATEST" ]; then
|
||||||
|
log "ERROR: Airplane server type only supports VERSION=LATEST"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SERVER=airplane-${VANILLA_VERSION}-jdk${JAVA_VER}.jar
|
||||||
|
|
||||||
|
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
||||||
|
downloadUrl="https://dl.airplane.gg/latest/Airplane-JDK${JAVA_VER}/launcher-airplane.jar"
|
||||||
|
log "Downloading Airplane from $downloadUrl ..."
|
||||||
|
curl -fsSL -o "$SERVER" "$downloadUrl"
|
||||||
|
if [ ! -f "$SERVER" ]; then
|
||||||
|
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Normalize on Spigot for later operations
|
||||||
|
export TYPE=SPIGOT
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
|
# Continue to Final Setup
|
||||||
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
@@ -38,16 +38,16 @@ if [ -n "$ICON" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! isTrue ${SKIP_LOG4J_CONFIG}; then
|
if isTrue ${ENABLE_ROLLING_LOGS:-false}; then
|
||||||
# Set up log configuration
|
# Set up log configuration
|
||||||
LOGFILE="/data/log4j2.xml"
|
LOGFILE="/data/log4j2.xml"
|
||||||
if [ ! -e "$LOGFILE" ]; then
|
if [ ! -e "$LOGFILE" ]; then
|
||||||
log "Creating log4j2.xml in ${LOGFILE}"
|
log "Creating log4j2.xml in ${LOGFILE}"
|
||||||
cp /tmp/log4j2.xml "$LOGFILE"
|
cp /tmp/log4j2.xml "$LOGFILE"
|
||||||
else
|
else
|
||||||
log "log4j2.xml already created, skipping"
|
log "log4j2.xml already created, skipping"
|
||||||
fi
|
fi
|
||||||
JVM_OPTS="-Dlog4j.configurationFile=/data/log4j2.xml ${JVM_OPTS}"
|
JVM_OPTS="-Dlog4j.configurationFile=/data/log4j2.xml ${JVM_OPTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
||||||
@@ -144,6 +144,13 @@ if isTrue "${USE_LARGE_PAGES}"; then
|
|||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if isTrue "${USE_FLARE_FLAGS}"; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:+UnlockDiagnosticVMOptions
|
||||||
|
-XX:+DebugNonSafepoints
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
if isTrue "${DEBUG_MEMORY}"; then
|
if isTrue "${DEBUG_MEMORY}"; then
|
||||||
log "Memory usage and availability (in MB)"
|
log "Memory usage and availability (in MB)"
|
||||||
uname -a
|
uname -a
|
||||||
@@ -200,10 +207,19 @@ EOF
|
|||||||
|
|
||||||
cd "${FTB_DIR}"
|
cd "${FTB_DIR}"
|
||||||
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
|
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
|
||||||
|
|
||||||
|
finalArgs=(
|
||||||
|
"${FTB_SERVER_START}"
|
||||||
|
)
|
||||||
|
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
exec mc-server-runner ${mcServerRunnerArgs} "${FTB_SERVER_START}"
|
if isTrue ${EXEC_DIRECTLY:-false}; then
|
||||||
|
"${finalArgs[@]}"
|
||||||
|
else
|
||||||
|
exec mc-server-runner ${mcServerRunnerArgs} "${finalArgs[@]}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# If we have a bootstrap.txt file... feed that in to the server stdin
|
# If we have a bootstrap.txt file... feed that in to the server stdin
|
||||||
if [ -f /data/bootstrap.txt ]; then
|
if [ -f /data/bootstrap.txt ]; then
|
||||||
@@ -211,8 +227,22 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "Starting the Minecraft server..."
|
log "Starting the Minecraft server..."
|
||||||
|
|
||||||
|
finalArgs=(
|
||||||
|
$JVM_XX_OPTS
|
||||||
|
$JVM_OPTS
|
||||||
|
$expandedDOpts
|
||||||
|
-jar $SERVER
|
||||||
|
"$@" $EXTRA_ARGS
|
||||||
|
)
|
||||||
|
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar $SERVER "$@" $EXTRA_ARGS
|
|
||||||
|
if isTrue ${EXEC_DIRECTLY:-false}; then
|
||||||
|
exec java "${finalArgs[@]}"
|
||||||
|
else
|
||||||
|
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java "${finalArgs[@]}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user