diff --git a/Dockerfile b/Dockerfile index 93bbb70d..922e8316 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,10 +11,12 @@ FROM eclipse-temurin:17-jre WORKDIR /app/ +COPY hotspot-entrypoint.sh / + COPY --from=build /app/build/libs/piped-1.0-all.jar /app/piped.jar COPY VERSION . EXPOSE 8080 -CMD java -server -Xmx1G -XX:+UnlockExperimentalVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseNUMA -XX:+UseG1GC -Xshare:on -jar /app/piped.jar +ENTRYPOINT ["/hotspot-entrypoint.sh"] diff --git a/Dockerfile.azul b/Dockerfile.azul index de258d0b..b376720b 100644 --- a/Dockerfile.azul +++ b/Dockerfile.azul @@ -11,10 +11,12 @@ FROM azul/zulu-openjdk:17-jre-headless-latest WORKDIR /app/ +COPY hotspot-entrypoint.sh / + COPY --from=build /app/build/libs/piped-1.0-all.jar /app/piped.jar COPY VERSION . EXPOSE 8080 -CMD java -server -Xmx1G -XX:+UnlockExperimentalVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseNUMA -XX:+UseG1GC -jar /app/piped.jar +ENTRYPOINT ["/hotspot-entrypoint.sh"] diff --git a/Dockerfile.azul.ci b/Dockerfile.azul.ci index 4c8b7db5..6c7c24d2 100644 --- a/Dockerfile.azul.ci +++ b/Dockerfile.azul.ci @@ -2,10 +2,12 @@ FROM azul/zulu-openjdk:17-jre-headless-latest WORKDIR /app/ +COPY hotspot-entrypoint.sh / + COPY ./piped.jar /app/piped.jar COPY VERSION . EXPOSE 8080 -CMD java -server -Xmx1G -XX:+UnlockExperimentalVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseNUMA -XX:+UseG1GC -jar /app/piped.jar +ENTRYPOINT ["/hotspot-entrypoint.sh"] diff --git a/Dockerfile.ci b/Dockerfile.ci index 8d58ec94..94acf719 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -2,10 +2,12 @@ FROM eclipse-temurin:17-jre WORKDIR /app/ +COPY hotspot-entrypoint.sh / + COPY ./piped.jar /app/piped.jar COPY VERSION . EXPOSE 8080 -CMD java -server -Xmx1G -XX:+UnlockExperimentalVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseNUMA -XX:+UseG1GC -Xshare:on -jar /app/piped.jar +ENTRYPOINT ["/hotspot-entrypoint.sh"] diff --git a/hotspot-entrypoint.sh b/hotspot-entrypoint.sh new file mode 100755 index 00000000..eea1684f --- /dev/null +++ b/hotspot-entrypoint.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +MAX_MEMORY=${MAX_MEMORY:-1G} + +java -server -Xmx"$MAX_MEMORY" -XX:+UnlockExperimentalVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseNUMA -XX:+UseG1GC -jar /app/piped.jar