22 jib 镜像发射器 一篇就够
2022-07-08 本文已影响0人
starQuest
1.Pom配置
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>x.x.x.ComponentWebSocketApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<from>
<image>openjdk:8-jre</image>
</from>
<to>
<image>harbor.bicisims.com/pgxt-test/${project.artifactId}</image>
<tags>
<tag>${project.version}</tag>
</tags>
<auth>
<username>admin</username>
<password>Harbor12345</password>
</auth>
</to>
<container>
<jvmFlags>
<jvmFlag>-Xms1g</jvmFlag>
<jvmFlag>-Xmx1g</jvmFlag>
</jvmFlags>
<!--镜像创建时间改成为当前时间-->
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
<mainClass>x.x.x.ComponentWebSocketApplication</mainClass>
<!--配置使用的时区-->
<environment>
<TZ>Asia/Shanghai</TZ>
</environment>
</container>
<allowInsecureRegistries>true</allowInsecureRegistries>
</configuration>
</plugin>
</plugins>
2.maven 命令 兼容http
clean install jib:build -Dmaven.test.skip=true -Djib.httpTimeout=0 -DsendCredentialsOverHttp=true -f pom.xml