

docker-maven-plugin插件的使用
source link: http://www.hechunbo.com/index.php/archives/414.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

docker-maven-plugin插件的使用
直接把jar包打成docker文件
官网地址如下
https://github.com/spotify/docker-maven-plugin
a,pom配置
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<!-- 需要配合 imageTags 使用, 对tag进行覆盖 -->
<forceTags>true</forceTags>
<imageTags>
<!-- <imageTag>${project.version}</imageTag>-->
<imageTag>latest</imageTag>
</imageTags>
<imageName>${project.artifactId}</imageName>
<!-- <newName>docker.io/hcb/mavendemo:${project.version}</newName>-->
<!-- docker远程服务器地址 -->
<dockerHost>http://192.168.133.141:2375</dockerHost>
<!-- Dockerfile文件存放目录 -->
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<!-- 把下面的几个文件*.jar 和lib文件夹, 和resources文件夹中的文件复制到docker目录下 -->
<include>${project.build.finalName}.jar</include>
<include>/lib/*</include>
<include>/resources/*</include>
</resource>
</resources>
</configuration>
</plugin>
执行完 mvn clean package docker:build以后, 可以看到会新生成一个images
也可以单独立执行mvn docker:build
clean是先清除,
package直接打包,
联合在一起就是先清除,再打包, 再打镜像.
重复执行会重复生成, 最好配置一下私有库.
Recommend
-
61
README.md vim-maven-plugin This plugin provides convenient functions to Apache Maven project. Main features: Detects your editing...
-
25
English | 简体中文 造轮子目的 使用yml配置来简化MyBatis Generator默认使用的xml配置 支持注释生成、lombok、swagger...
-
23
jetty-maven-plugin静态文件保存不了 妙音 posted @ 2014年12月31日 11:08 in java , 29856 阅读 ...
-
9
使用maven shade plugin 打可执行Jar包 发表于 2017-05-14...
-
6
使用 Maven Enforcer 插件检查依赖2022-03-29最近公司项目要对一些内部依赖做集中升级。为此,D瓜哥发布...
-
4
使用 dockerfile-maven-plugin 构建 docker 镜像 2022-07-16...
-
10
Use the wildfly-maven-plugin to create a Docker image of your application By Jeff Mesnil | August 04, 2022 In this article, we will explain how a developer using the Docker image for Wi...
-
6
欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码): https://github.com/zq2599/blog_demos 关于Jib
-
5
欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码): https://github.com/zq2599/blog_demos 近期在用Jib插件将Java...
-
4
SpringBoot使用git-commit-id-maven-plugin打包 - Naylor - 博客园 git-commit-id-maven-plugin 是一个maven 插件,用来在打包的时候...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK