From 954f9eec14e1a04949feca03505a6cc1ba311159 Mon Sep 17 00:00:00 2001 From: XiaoHH <1431984546@qq.com> Date: Fri, 2 Jun 2023 13:26:47 +0800 Subject: [PATCH] =?UTF-8?q?Docker=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api-passenger/pom.xml | 1 + docker/api/api-passenger/Dockerfile | 25 +++++++++++++++++++ .../service-verification-code/Dockerfile | 25 +++++++++++++++++++ service/service-verification-code/pom.xml | 1 + 4 files changed, 52 insertions(+) create mode 100644 docker/api/api-passenger/Dockerfile create mode 100644 docker/service/service-verification-code/Dockerfile diff --git a/api/api-passenger/pom.xml b/api/api-passenger/pom.xml index ab8205d..e0db710 100644 --- a/api/api-passenger/pom.xml +++ b/api/api-passenger/pom.xml @@ -69,6 +69,7 @@ + ${project.artifactId} org.springframework.boot diff --git a/docker/api/api-passenger/Dockerfile b/docker/api/api-passenger/Dockerfile new file mode 100644 index 0000000..89bcf8e --- /dev/null +++ b/docker/api/api-passenger/Dockerfile @@ -0,0 +1,25 @@ +# 最低使用jdk11打包这个项目 +FROM openjdk:11-jre + +# 作者为 XiaoHH +MAINTAINER XiaoHH + +# 添加可执行文件到 +ADD api-passenger.jar add.jar + +# 暴露指定端口 +EXPOSE 10000 + +# JVM 调优参数 +ENV JAVA_OPTION="-Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:+PrintGCDetails -Xloggc:/var/log/api-passenger.gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC" + +# 设置内存大小 +ENV XMX=256M +ENV XMS=256M +ENV XMN=128M + +# 运行环境参数 +ENV SPRING_PROFILES_ACTIVE=dev + +# 运行程序 +ENTRYPOINT ["sh", "-c", "java -Djava.security.egd=file:/dev/./urandom -jar -Xmx${XMX} -Xms${MXS} -Xmn${XMN} $JAVA_OPTION -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE} /app.jar"] diff --git a/docker/service/service-verification-code/Dockerfile b/docker/service/service-verification-code/Dockerfile new file mode 100644 index 0000000..375a597 --- /dev/null +++ b/docker/service/service-verification-code/Dockerfile @@ -0,0 +1,25 @@ +# 最低使用jdk11打包这个项目 +FROM openjdk:11-jre + +# 作者为 XiaoHH +MAINTAINER XiaoHH + +# 添加可执行文件到 +ADD service-verification-code.jar add.jar + +# 暴露指定端口 +EXPOSE 10010 + +# JVM 调优参数 +ENV JAVA_OPTION="-Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:+PrintGCDetails -Xloggc:/var/log/service-verification-code.gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC" + +# 设置内存大小 +ENV XMX=256M +ENV XMS=256M +ENV XMN=128M + +# 运行环境参数 +ENV SPRING_PROFILES_ACTIVE=dev + +# 运行程序 +ENTRYPOINT ["sh", "-c", "java -Djava.security.egd=file:/dev/./urandom -jar -Xmx${XMX} -Xms${MXS} -Xmn${XMN} $JAVA_OPTION -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE} /app.jar"] diff --git a/service/service-verification-code/pom.xml b/service/service-verification-code/pom.xml index fd5b340..eaa3d8d 100644 --- a/service/service-verification-code/pom.xml +++ b/service/service-verification-code/pom.xml @@ -69,6 +69,7 @@ + ${project.artifactId} org.springframework.boot