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 nice -20 apk update
|
||||
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
|
||||
ADD entrypoint.sh /app/entrypoint.sh
|
||||
COPY --from=builder /builder/bin/rcon /usr/bin/rcon
|
||||
|
|
|
@ -44,7 +44,13 @@ MCSD_MEMORY_MIN=2048M
|
|||
## <= 1.16 | 8
|
||||
## <= 1.16 | 11 (may increase performance)
|
||||
## >= 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
|
||||
## Applies a modified variant of Aikar's Flags
|
||||
|
|
|
@ -6,6 +6,7 @@ services:
|
|||
stop_grace_period: 120s
|
||||
volumes:
|
||||
- ./server:/data
|
||||
- ./jvm:/jvm
|
||||
env_file:
|
||||
- ./config.env
|
||||
ports:
|
||||
|
|
|
@ -71,10 +71,15 @@ function initialize() {
|
|||
exit 1
|
||||
fi
|
||||
# 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"
|
||||
export "MCSD_JAVA_VERSION=17"
|
||||
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
|
||||
if [ ! "${MCSD_OPTIMIZED_FLAGS}" == "true" ] && [ ! "${MCSD_OPTIMIZED_FLAGS}" == "false" ]; then
|
||||
echo ":: Warning: No/Invalid value supplied to \$MCSD_OPTIMIZED_FLAGS, defaulting to true"
|
||||
|
@ -135,6 +140,12 @@ function compile_args() {
|
|||
# Compile java flags
|
||||
function compile_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}"
|
||||
case "${MCSD_OPTIMIZED_FLAGS}" in
|
||||
"true")
|
||||
|
@ -156,7 +167,7 @@ function compile_flags() {
|
|||
internal_error "\$MCSD_GARBAGECOLLECTOR has invalid value"
|
||||
;;
|
||||
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"
|
||||
fi
|
||||
}
|
||||
|
@ -172,7 +183,7 @@ compile_flags
|
|||
echo ":: Starting server"
|
||||
cd /data||exit 69
|
||||
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
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue