From 1d9dbe32f14b7f7c2ba28168fc031e10e5f8b562 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:25:52 +0100 Subject: [PATCH] Add common hotspot entrypoint. --- Dockerfile | 4 +++- Dockerfile.azul | 4 +++- Dockerfile.azul.ci | 4 +++- Dockerfile.ci | 4 +++- hotspot-entrypoint.sh | 5 +++++ 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100755 hotspot-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 93bbb70..922e831 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 de258d0..b376720 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 4c8b7db..6c7c24d 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 8d58ec9..94acf71 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 0000000..eea1684 --- /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