java项目maven package自动打包镜像推送到docker

mavenpackage自动打包镜像推送到docker

pom.xml

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <configuration>
                    <!-- 拉取所需的基础镜像 - 这里用于运行springboot项目 -->
                    <from>
                        <image>registry.cn-shanghai.aliyuncs.com/xxxxxxx/openjdk:17.0-jdk-buster</image>
                        <auth>
                            <!--在docker-hub或者阿里云上的账号和密码-->
                            <username>xxxxxxxxxx</username>
                            <password>xxxxxxxxxx</password>
                        </auth>
                    </from>
                    <!-- 最后生成的镜像配置 -->
                    <to>
                        <!-- push docer-hub官方仓库。用户名/镜像名:版本号, -->
                        <image>registry.cn-shanghai.aliyuncs.com/xxxxxxx/xxxxxxxxxx</image>
                        <!-- 如果是阿里云的容器镜像仓库,则使用容器的配置 前缀/命名空间/仓库名 -->
                        <!--<image>registry.cn-chengdu.aliyuncs.com/renbaojia/ctfo</image>-->
                        <tags>
                            <tag>${project.version}_${maven.build.timestamp}</tag>
                        </tags>
                        <auth>
                            <!--在docker-hub或者阿里云上的账号和密码-->
                            <username>xxxxxxxxxx</username>
                            <password>xxxxxxxxxx</password>
                        </auth>
                    </to>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

已发布

分类

作者:

标签

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注