700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > jib-maven-plugin插件快速构建docker镜像

jib-maven-plugin插件快速构建docker镜像

时间:2021-12-10 15:35:49

相关推荐

jib-maven-plugin插件快速构建docker镜像

文章目录

前言一、使用步骤1.编写pom文件2.刷新mavem 总结

前言

使用jib-maven-plugin插件可以将springboot代码制作为容器镜像并push到远程容器仓库

一、使用步骤

1.编写pom文件

<plugin><groupId>com.google.cloud.tools</groupId><artifactId>jib-maven-plugin</artifactId><version>1.8.0</version><configuration><!-- 拉取所需的基础镜像 - 这里用于运行springboot项目 --><from><image>openjdk:alpine</image></from><!-- 最后生成的镜像配置 --><to><!-- push docer-hub官方仓库。用户名/镜像名:版本号, --><image>smallren/xxxx</image><!-- 如果是阿里云的容器镜像仓库,则使用容器的配置 前缀/命名空间/仓库名 --><!--<image>-/renbaojia/ctfo</image>--><tags><!--版本号--><tag>1.1.0</tag></tags><auth><!--在docker-hub或者阿里云上的账号和密码--><username>xxxxx</username><password>xxxxxx</password></auth></to><container><!--springboot项目的入口类 -><mainClass>xx.xx.xxxApplication</mainClass><useCurrentTimestamp>true</useCurrentTimestamp><ports><!--指定镜像端口 , 这里没用 docfile的操作--><port>80</port></ports></container></configuration><executions><execution><phase>package</phase><goals><goal>build</goal></goals></execution></executions></plugin>

2.刷新mavem

点击 jib:build操作

总结

使用maven插件能帮助我们快速的构建SpringBoot项目镜像并上传到doker容器

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。