:添加dockerfile-maven插件构建Docker镜像

This commit is contained in:
haoxr 2020-12-03 23:55:36 +08:00
parent f78fa0a5c7
commit 7302bb3626
3 changed files with 36 additions and 6 deletions

View File

@ -0,0 +1,7 @@
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
ADD target/${JAR_FILE} app.jar
EXPOSE 9999
ENTRYPOINT ["java","-jar","/app.jar"]

View File

@ -13,12 +13,7 @@
<artifactId>youlai-gateway</artifactId>
<properties>
<youlai.version>1.0.0-SNAPSHOT</youlai.version>
</properties>
<dependencies>
<dependency>
<groupId>com.youlai</groupId>
<artifactId>common-core</artifactId>
@ -64,4 +59,33 @@
</dependency>
</dependencies>
<properties>
<youlai.version>1.0.0-SNAPSHOT</youlai.version>
<dockerfile-maven-version>1.4.13</dockerfile-maven-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile-maven-version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1 +0,0 @@
FROM java:8