From 64ba12cb2ed5763165415b8d486d6040f2a88061 Mon Sep 17 00:00:00 2001 From: liaozan <378024053@qq.com> Date: Mon, 31 Jul 2023 00:55:31 +0800 Subject: [PATCH] Update build-script --- Dockerfile | 8 +++++++- entrypoint.sh | 6 ++++++ k8s-deploy-template.yaml | 4 ---- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index ea10920..f9d4c0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,14 @@ COPY --from=builder app/spring-boot-loader/ ./ COPY --from=builder app/snapshot-dependencies/ ./ COPY --from=builder app/application/ ./ +COPY build-script/entrypoint.sh entrypoint.sh + +RUN chmod +x /app/entrypoint.sh + ENV EXT_JVM_OPTS="${JAVA_OPTS}" +ENV PROFILE="${PROFILE}" + ENV JVM_OPTS="-javaagent:/opt/skywalking-agent/skywalking-agent.jar=agent.service_name=${APP_NAME},collector.backend_service=skywalking-oap-server.devops:11800\ -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false\ -XX:MaxRAMPercentage=60 -XX:MaxMetaspaceSize=256m\ @@ -19,4 +25,4 @@ ENV JVM_OPTS="-javaagent:/opt/skywalking-agent/skywalking-agent.jar=agent.servic -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/heapdump/heapdump.hprof -XX:OnOutOfMemoryError=/app/dump-file-rollover.sh\ -XX:-OmitStackTraceInFastThrow -XX:+PrintCommandLineFlags" -ENTRYPOINT exec java $JVM_OPTS $EXT_JVM_OPTS org.springframework.boot.loader.JarLauncher --spring.profiles.active=${PROFILE} +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..e64db63 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Create the required directories +mkdir -p "/data/logs/gc" "/data/heapdump" + +# Start process +exec java $JVM_OPTS $EXT_JVM_OPTS org.springframework.boot.loader.JarLauncher --spring.profiles.active=$PROFILE diff --git a/k8s-deploy-template.yaml b/k8s-deploy-template.yaml index 32f5b4a..c1012f4 100644 --- a/k8s-deploy-template.yaml +++ b/k8s-deploy-template.yaml @@ -41,10 +41,6 @@ spec: - name: actuator containerPort: 1024 protocol: TCP - lifecycle: - postStart: - exec: - command: ["/bin/sh", "-c", "umask 0022 && mkdir -p /data/logs/gc /data/heapdump"] startupProbe: httpGet: scheme: HTTP -- GitLab