docker 打包配置

This commit is contained in:
shikong 2023-08-27 20:53:35 +08:00
parent dfee61b6af
commit 14069c1bee
3 changed files with 73 additions and 1 deletions

51
pom.xml
View File

@ -52,8 +52,36 @@
<!--SpringDoc-->
<springdoc.version>2.2.0</springdoc.version>
<!--Docker打包配置-->
<!-- <docker.repository.url>10.10.10.200:5000</docker.repository.url>-->
<!-- <docker.registry.name>skcks.cn</docker.registry.name>-->
<!-- <docker.registry.username>XXX</docker.registry.username>-->
<!-- <docker.registry.password>XXX</docker.registry.password>-->
<docker.maven.plugin.version>1.4.13</docker.maven.plugin.version>
</properties>
<profiles>
<profile>
<id>jar</id>
<properties>
<skip.docker>true</skip.docker>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>docker</id>
<properties>
<skip.docker>false</skip.docker>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
@ -150,6 +178,29 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${docker.maven.plugin.version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>${skip.docker}</skip>
<repository>skcks.cn/gb28181-docking-platform</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>

13
starter/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM eclipse-temurin:17-jdk
MAINTAINER Shikong <919411476@qq.com>
ENV HOME_PATH /opt/gb28181-docking-platform/
RUN mkdir -p $HOME_PATH
WORKDIR $HOME_PATH
ADD target/starter.jar /opt/gb28181-docking-platform/starter.jar
EXPOSE 28181
ENTRYPOINT ["java", "-jar","/opt/gb28181-docking-platform/starter.jar"]

View File

@ -90,8 +90,16 @@
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<tag>${project.version}</tag>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>