Docker打包

main
XiaoHH 2 years ago
parent 373e6c0ae6
commit 954f9eec14

@ -69,6 +69,7 @@
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

@ -0,0 +1,25 @@
# 最低使用jdk11打包这个项目
FROM openjdk:11-jre
# 作者为 XiaoHH
MAINTAINER XiaoHH <xiaohh@yueyang.city>
# 添加可执行文件到
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"]

@ -0,0 +1,25 @@
# 最低使用jdk11打包这个项目
FROM openjdk:11-jre
# 作者为 XiaoHH
MAINTAINER XiaoHH <xiaohh@yueyang.city>
# 添加可执行文件到
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"]

@ -69,6 +69,7 @@
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

Loading…
Cancel
Save