赞
踩
<properties> <docker.image.prefix>swr.cn-north-4.myhuaweicloud.com/xliangliango</docker.image.prefix> </properties> <plugin> <groupId>com.spotify</groupId> <artifactId>dockerfile-maven-plugin</artifactId> <version>1.4.13</version> <executions> <execution> <id>default</id> <goals> <goal>build</goal> <goal>push</goal> </goals> </execution> </executions> <configuration> <!-- 对应docker images 中的 repository --> <repository>${docker.image.prefix}/${project.artifactId}</repository> <tag>${project.version}</tag> <buildArgs> <JAR_FILE>${project.build.finalName}.jar</JAR_FILE> </buildArgs> </configuration> </plugin>
FROM java:8
EXPOSE 8080
ARG JAR_FILE
ADD target/${JAR_FILE} /example.jar
ENTRYPOINT ["java", "-jar","/example.jar"]
参数说明:
mvn clean package dockerfile:build -Dmaven.test.skip=true
docker run -d -p 8088:8088 swr.cn-north-4.myhuaweicloud.com/xliangliango/example:0.0.1-SNAPSHOT
验证:
验证:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。