Compare commits
2 commits
b0115943c8
...
cf1386628e
Author | SHA1 | Date | |
---|---|---|---|
cf1386628e | |||
f12db20ac9 |
4 changed files with 24 additions and 6 deletions
|
@ -29,7 +29,7 @@ LABEL org.opencontainers.image.licenses="GPL-3.0-only"
|
||||||
RUN true
|
RUN true
|
||||||
RUN nice -20 apk update
|
RUN nice -20 apk update
|
||||||
RUN nice -20 apk upgrade
|
RUN nice -20 apk upgrade
|
||||||
RUN nice -20 apk add bash libstdc++ openjdk21-jre openjdk17-jre openjdk11-jre
|
RUN nice -20 apk add bash libstdc++ openjdk21-jre openjdk17-jre openjdk11-jre openjdk8-jre
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
ADD entrypoint.sh /app/entrypoint.sh
|
ADD entrypoint.sh /app/entrypoint.sh
|
||||||
COPY --from=builder /builder/bin/rcon /usr/bin/rcon
|
COPY --from=builder /builder/bin/rcon /usr/bin/rcon
|
||||||
|
|
|
@ -44,7 +44,13 @@ MCSD_MEMORY_MIN=2048M
|
||||||
## <= 1.16 | 8
|
## <= 1.16 | 8
|
||||||
## <= 1.16 | 11 (may increase performance)
|
## <= 1.16 | 11 (may increase performance)
|
||||||
## >= 1.17 | 17
|
## >= 1.17 | 17
|
||||||
MCSD_JAVA_VERSION=17
|
## >= 1.20.5 | 21
|
||||||
|
MCSD_JAVA_VERSION=21
|
||||||
|
|
||||||
|
# JAVA_CUSTOM
|
||||||
|
## Set this to 'true' if you want to use a custom JVM
|
||||||
|
## located at './jvm/'. This will update $JAVA_HOME
|
||||||
|
MCSD_JAVA_CUSTOM=false
|
||||||
|
|
||||||
# OPTIMIZED_FLAGS
|
# OPTIMIZED_FLAGS
|
||||||
## Applies a modified variant of Aikar's Flags
|
## Applies a modified variant of Aikar's Flags
|
||||||
|
|
|
@ -6,6 +6,7 @@ services:
|
||||||
stop_grace_period: 120s
|
stop_grace_period: 120s
|
||||||
volumes:
|
volumes:
|
||||||
- ./server:/data
|
- ./server:/data
|
||||||
|
- ./jvm:/jvm
|
||||||
env_file:
|
env_file:
|
||||||
- ./config.env
|
- ./config.env
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -71,10 +71,15 @@ function initialize() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Java version
|
# Java version
|
||||||
if [ ! "${MCSD_JAVA_VERSION}" == "17" ] && [ ! "${MCSD_JAVA_VERSION}" == "11" ] && [ ! "${MCSD_JAVA_VERSION}" == "8" ]; then
|
if [ ! "${MCSD_JAVA_VERSION}" == "21" ] && [ ! "${MCSD_JAVA_VERSION}" == "17" ] && [ ! "${MCSD_JAVA_VERSION}" == "11" ] && [ ! "${MCSD_JAVA_VERSION}" == "8" ]; then
|
||||||
echo ":: Warning: No/Invalid java version supplied to \$MCSD_JAVA_VERSION, defaulting to java version 17"
|
echo ":: Warning: No/Invalid java version supplied to \$MCSD_JAVA_VERSION, defaulting to java version 17"
|
||||||
export "MCSD_JAVA_VERSION=17"
|
export "MCSD_JAVA_VERSION=17"
|
||||||
fi
|
fi
|
||||||
|
# Java custom JVM
|
||||||
|
if [ ! "${MCSD_JAVA_CUSTOM}" == "true" ] && [ ! "${MCSD_JAVA_CUSTOM}" == "false" ]; then
|
||||||
|
echo ":: Warning: No/Invalid value supplied to \$MCSD_JAVA_CUSTOM, defaulting to false"
|
||||||
|
export "MCSD_JAVA_CUSTOM=false"
|
||||||
|
fi
|
||||||
# Java optimization
|
# Java optimization
|
||||||
if [ ! "${MCSD_OPTIMIZED_FLAGS}" == "true" ] && [ ! "${MCSD_OPTIMIZED_FLAGS}" == "false" ]; then
|
if [ ! "${MCSD_OPTIMIZED_FLAGS}" == "true" ] && [ ! "${MCSD_OPTIMIZED_FLAGS}" == "false" ]; then
|
||||||
echo ":: Warning: No/Invalid value supplied to \$MCSD_OPTIMIZED_FLAGS, defaulting to true"
|
echo ":: Warning: No/Invalid value supplied to \$MCSD_OPTIMIZED_FLAGS, defaulting to true"
|
||||||
|
@ -135,6 +140,12 @@ function compile_args() {
|
||||||
# Compile java flags
|
# Compile java flags
|
||||||
function compile_flags() {
|
function compile_flags() {
|
||||||
echo ":: Compiling java flags"
|
echo ":: Compiling java flags"
|
||||||
|
if [ "${MCSD_JAVA_CUSTOM}" == "true" ]; then
|
||||||
|
export "JAVA_HOME=/jvm"
|
||||||
|
else
|
||||||
|
export "JAVA_HOME=/usr/lib/jvm/java-${MCSD_JAVA_VERSION}-openjdk"
|
||||||
|
fi
|
||||||
|
|
||||||
export "FLAGS=-Xms${MCSD_MEMORY_MIN} -Xmx${MCSD_MEMORY_MAX}"
|
export "FLAGS=-Xms${MCSD_MEMORY_MIN} -Xmx${MCSD_MEMORY_MAX}"
|
||||||
case "${MCSD_OPTIMIZED_FLAGS}" in
|
case "${MCSD_OPTIMIZED_FLAGS}" in
|
||||||
"true")
|
"true")
|
||||||
|
@ -156,7 +167,7 @@ function compile_flags() {
|
||||||
internal_error "\$MCSD_GARBAGECOLLECTOR has invalid value"
|
internal_error "\$MCSD_GARBAGECOLLECTOR has invalid value"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [ "${MCSD_JAVA_VERSION}" == "17" ]; then
|
if [ "${MCSD_JAVA_VERSION}" == "17" ] || [ "${MCSD_JAVA_VERSION}" == "21" ]; then
|
||||||
export "FLAGS=${FLAGS} --add-modules=jdk.incubator.vector"
|
export "FLAGS=${FLAGS} --add-modules=jdk.incubator.vector"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -172,7 +183,7 @@ compile_flags
|
||||||
echo ":: Starting server"
|
echo ":: Starting server"
|
||||||
cd /data||exit 69
|
cd /data||exit 69
|
||||||
if [ -z "${MCSD_CUSTOM_ARGS}" ]; then
|
if [ -z "${MCSD_CUSTOM_ARGS}" ]; then
|
||||||
exec "/usr/lib/jvm/java-${MCSD_JAVA_VERSION}-openjdk/bin/java" ${FLAGS} -jar "/data/server.jar" ${ARGS}
|
exec "${JAVA_HOME}/bin/java" ${FLAGS} -jar "/data/server.jar" ${ARGS}
|
||||||
else
|
else
|
||||||
exec "/usr/lib/jvm/java-${MCSD_JAVA_VERSION}-openjdk/bin/java" ${MCSD_CUSTOM_ARGS} -jar "/data/server.jar" ${ARGS}
|
exec "${JAVA_HOME}/bin/java" ${MCSD_CUSTOM_ARGS} -jar "/data/server.jar" ${ARGS}
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue