【更新】 优化docker打包方式

This commit is contained in:
WeiXiao
2026-03-26 10:13:30 +08:00
parent 97f7dbf7b7
commit 5b44a80d4f
2 changed files with 18 additions and 4 deletions

View File

@@ -3,10 +3,10 @@
FROM eclipse-temurin:8-jre
## 创建目录,并使用它作为工作目录
RUN mkdir -p /jeelowcode-server
WORKDIR /jeelowcode-server
RUN mkdir -p /jeelowcode-admin
WORKDIR /jeelowcode-admin
## 将后端项目的 Jar 文件,复制到镜像中
COPY ./target/jeelowcode-server.jar app.jar
COPY ./target/jeelowcode-admin.jar app.jar
## 设置 TZ 时区
ENV TZ=Asia/Shanghai
@@ -14,7 +14,7 @@ ENV TZ=Asia/Shanghai
ENV JAVA_OPTS="-Xms512m -Xmx512m -Djava.security.egd=file:/dev/./urandom"
## 应用参数
ENV ARGS=""
ENV ARGS="--spring.profiles.active=local"
## 暴露后端项目的 48080 端口
EXPOSE 48080

View File

@@ -74,6 +74,20 @@
</execution>
</executions>
</plugin>
<!-- docker打包 -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.13</version>
<configuration>
<repository>${project.artifactId}</repository>
<tag>v1.0.1</tag>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>