docker部署
This commit is contained in:
parent
0ec8e431cc
commit
291d776519
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
|
<docker.image.prefix>cdzy_ebike</docker.image.prefix>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
@ -184,6 +185,24 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.spotify</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
<version>1.2.2</version>
|
||||||
|
<configuration>
|
||||||
|
<!--远程Docker的地址-->
|
||||||
|
<dockerHost>http://192.168.2.226:2375</dockerHost><!--镜像名称,前缀/项目名-->
|
||||||
|
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
|
||||||
|
<dockerDirectory>src/main/docker</dockerDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<targetPath>/</targetPath>
|
||||||
|
<directory>${project.build.directory}</directory>
|
||||||
|
<include>${project.build.finalName}.jar</include>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|||||||
21
ebike-user/src/main/docker/Dockerfile
Normal file
21
ebike-user/src/main/docker/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
# 使用官方Eclipse Temurin镜像作为基础镜像(JDK17兼容Spring Boot 3.x)
|
||||||
|
FROM eclipse-temurin:17-jdk-jammy
|
||||||
|
|
||||||
|
VOLUME /opt/docker-images
|
||||||
|
|
||||||
|
ADD ebike-user-0.0.1-SNAPSHOT.jar /ebike-user.jar
|
||||||
|
|
||||||
|
|
||||||
|
# 设置JVM参数(根据实际需求调整)
|
||||||
|
ENV JAVA_OPTS="-Xms512m -Xmx1024m -Dspring.profiles.active=dev"
|
||||||
|
|
||||||
|
# 暴露应用端口(与application.yml配置一致)
|
||||||
|
EXPOSE 10012
|
||||||
|
|
||||||
|
# 健康检查配置
|
||||||
|
HEALTHCHECK --interval=30s --timeout=3s \
|
||||||
|
CMD curl -f http://localhost:10012/actuator/health || exit 1
|
||||||
|
|
||||||
|
# 容器启动命令
|
||||||
|
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar ebike-user.jar"]
|
||||||
Loading…
x
Reference in New Issue
Block a user