jib部署到阿里云容器镜像
1、本地Docker镜像发布到阿里云的Docker Hub
2、创建镜像仓库
地址:https://cr.console.aliyun.com/cn-hangzhou/repositories
本地测试的话,选择本地仓库
3、jib的pom.xml配置
<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>1.0.1</version>
<configuration>
<from>
<!--base image -->
<image>openjdk:alpine</image>
</from>
<to>
<!--目标镜像registry地址,:前面是发布镜像的名称,:后面是发布的版本号 -->
<image>registry.cn-hangzhou.aliyuncs.com/docker-wei/${project.artifactId}:${project.version}</image>
<!-- 阿里云镜像账号 -->
<auth>
<username>tankmk</username>
<password>[email protected]$</password>
</auth>
<tags>
<tag>tag</tag>
<tag>latest</tag>
</tags>
</to>
<allowInsecureRegistries>true</allowInsecureRegistries>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
注意:
${project.artifactId}为第二步中的仓库名称。
4、发布
mvn clean package