mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 14:24:28 +00:00
parent
b881a27c8d
commit
190e401452
4 changed files with 58 additions and 16 deletions
|
@ -2,9 +2,6 @@ FROM adoptopenjdk/openjdk11:alpine-jre
|
|||
|
||||
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 \
|
||||
openssl \
|
||||
imagemagick \
|
||||
|
@ -69,6 +66,8 @@ COPY server.properties /tmp/server.properties
|
|||
COPY log4j2.xml /tmp/log4j2.xml
|
||||
WORKDIR /data
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
ENV UID=1000 GID=1000 \
|
||||
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
||||
TYPE=VANILLA VERSION=LATEST \
|
||||
|
|
20
README.md
20
README.md
|
@ -1097,6 +1097,16 @@ 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:
|
||||
`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:
|
||||
|
@ -1106,6 +1116,16 @@ The openj9 image tags include specific variables to simplify configuration:
|
|||
- `-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
|
||||
|
||||
You can configure the timezone to match yours by setting the `TZ` environment variable:
|
||||
|
|
2
start
2
start
|
@ -5,7 +5,7 @@
|
|||
umask 0002
|
||||
chmod g+w /data
|
||||
|
||||
if [ $(id -u) = 0 ]; then
|
||||
if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then
|
||||
runAsUser=minecraft
|
||||
runAsGroup=minecraft
|
||||
|
||||
|
|
|
@ -38,16 +38,16 @@ if [ -n "$ICON" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if ! isTrue ${SKIP_LOG4J_CONFIG}; then
|
||||
# Set up log configuration
|
||||
LOGFILE="/data/log4j2.xml"
|
||||
if [ ! -e "$LOGFILE" ]; then
|
||||
if isTrue ${ENABLE_ROLLING_LOGS:-false}; then
|
||||
# Set up log configuration
|
||||
LOGFILE="/data/log4j2.xml"
|
||||
if [ ! -e "$LOGFILE" ]; then
|
||||
log "Creating log4j2.xml in ${LOGFILE}"
|
||||
cp /tmp/log4j2.xml "$LOGFILE"
|
||||
else
|
||||
else
|
||||
log "log4j2.xml already created, skipping"
|
||||
fi
|
||||
JVM_OPTS="-Dlog4j.configurationFile=/data/log4j2.xml ${JVM_OPTS}"
|
||||
fi
|
||||
JVM_OPTS="-Dlog4j.configurationFile=/data/log4j2.xml ${JVM_OPTS}"
|
||||
fi
|
||||
|
||||
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
||||
|
@ -200,10 +200,19 @@ EOF
|
|||
|
||||
cd "${FTB_DIR}"
|
||||
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
|
||||
|
||||
finalArgs=(
|
||||
"${FTB_SERVER_START}"
|
||||
)
|
||||
|
||||
if isTrue ${DEBUG_EXEC}; then
|
||||
set -x
|
||||
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
|
||||
# If we have a bootstrap.txt file... feed that in to the server stdin
|
||||
if [ -f /data/bootstrap.txt ]; then
|
||||
|
@ -211,8 +220,22 @@ else
|
|||
fi
|
||||
|
||||
log "Starting the Minecraft server..."
|
||||
|
||||
finalArgs=(
|
||||
$JVM_XX_OPTS
|
||||
$JVM_OPTS
|
||||
$expandedDOpts
|
||||
-jar $SERVER
|
||||
"$@" $EXTRA_ARGS
|
||||
)
|
||||
|
||||
if isTrue ${DEBUG_EXEC}; then
|
||||
set -x
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue