From 4be2920e450a009327b9363eae9e27730aafb9f0 Mon Sep 17 00:00:00 2001 From: liaozan <378024053@qq.com> Date: Sun, 20 Aug 2023 22:53:36 +0800 Subject: [PATCH] Polish --- Dockerfile | 9 +++++---- Dockerfile-pdf-generate | 15 +++++++-------- scripts/arthas.sh | 3 +++ scripts/dump-file-rollover.sh | 8 ++++++++ entrypoint.sh => scripts/entrypoint.sh | 0 5 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 scripts/arthas.sh create mode 100755 scripts/dump-file-rollover.sh rename entrypoint.sh => scripts/entrypoint.sh (100%) diff --git a/Dockerfile b/Dockerfile index c23741d..ad83cf6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,9 +10,9 @@ 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 +COPY build-script/scripts/*.sh /app/ -RUN chmod +x /app/entrypoint.sh +RUN chmod +x /app/*.sh ENV EXT_JVM_OPTS="${JAVA_OPTS}" @@ -20,8 +20,9 @@ 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=50 -XX:MaxMetaspaceSize=512m -XX:+ClassUnloading\ - -XX:+UseG1GC -XX:G1HeapRegionSize=8m -XX:+UseStringDeduplication -Xlog:gc*:/data/logs/gc/gc-%t.log:time,uptime:filecount=50\ + -XX:+UseG1GC -XX:G1HeapRegionSize=8m -XX:+UseStringDeduplication -XX:+ClassUnloading\ + -XX:InitialRAMPercentage=50 -XX:MaxRAMPercentage=50 -XX:MaxMetaspaceSize=512m\ + -Xlog:gc*=info,gc+heap=debug,gc+age=trace:/data/logs/gc/gc-%t.log:time:filecount=20,filesize=20m\ -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/heapdump/heapdump.hprof -XX:OnOutOfMemoryError=/app/dump-file-rollover.sh\ -XX:-OmitStackTraceInFastThrow -XX:+PrintCommandLineFlags" diff --git a/Dockerfile-pdf-generate b/Dockerfile-pdf-generate index deac40c..4697e59 100644 --- a/Dockerfile-pdf-generate +++ b/Dockerfile-pdf-generate @@ -1,9 +1,5 @@ FROM registry-vpc.cn-hangzhou.aliyuncs.com/schbrain-base/jdk:11 as builder WORKDIR app -RUN wget https://schbrain-attachment-online.oss-cn-hangzhou.aliyuncs.com/font/font.sh \ - && chmod +x /app/font.sh \ - && /app/font.sh \ - && rm /app/font.sh COPY ${JAR_FILE} app.jar RUN java -Djarmode=layertools -jar app.jar extract @@ -14,9 +10,11 @@ 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 wget https://schbrain-attachment-online.oss-cn-hangzhou.aliyuncs.com/font/font.sh && chmod +x /app/font.sh && /app/font.sh && rm /app/font.sh -RUN chmod +x /app/entrypoint.sh +COPY build-script/scripts/*.sh /app/ + +RUN chmod +x /app/*.sh ENV EXT_JVM_OPTS="${JAVA_OPTS}" @@ -24,8 +22,9 @@ 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\ - -XX:+UseG1GC -XX:+UseStringDeduplication -XX:G1HeapRegionSize=4m -Xlog:gc*:/data/logs/gc/gc-%t.log:time,uptime:filecount=50\ + -XX:+UseG1GC -XX:G1HeapRegionSize=8m -XX:+UseStringDeduplication -XX:+ClassUnloading\ + -XX:InitialRAMPercentage=50 -XX:MaxRAMPercentage=50 -XX:MaxMetaspaceSize=512m\ + -Xlog:gc*=info,gc+heap=debug,gc+age=trace:/data/logs/gc/gc-%t.log:time:filecount=20,filesize=20m\ -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/heapdump/heapdump.hprof -XX:OnOutOfMemoryError=/app/dump-file-rollover.sh\ -XX:-OmitStackTraceInFastThrow -XX:+PrintCommandLineFlags" diff --git a/scripts/arthas.sh b/scripts/arthas.sh new file mode 100644 index 0000000..fab3ec2 --- /dev/null +++ b/scripts/arthas.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# arthas has been built into the /opt/arthas directory of the jdk image +java -jar /opt/arthas/arthas-boot.jar diff --git a/scripts/dump-file-rollover.sh b/scripts/dump-file-rollover.sh new file mode 100755 index 0000000..a0ae1b2 --- /dev/null +++ b/scripts/dump-file-rollover.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +datetime=$(date "+%Y%m%d%H%M%S") +dumps=$(find /data/heapdump -name '*.hprof') +for dump in $dumps +do + mv $dump `echo "$dump.$datetime"` +done \ No newline at end of file diff --git a/entrypoint.sh b/scripts/entrypoint.sh similarity index 100% rename from entrypoint.sh rename to scripts/entrypoint.sh -- GitLab