请注意:环境变量$开头的请自行替换
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.10.RELEASE</version>
</plugin>
<!--Maven to Docker-->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>${jib.version}</version>
<configuration>
<from>
<image>${project.jib-image}</image>
</from>
<to>
<image>${godname}/${project.artifactId}</image>
<tags>
<tag>latest</tag>
</tags>
</to>
<outputPaths>
<tar>${project.tar}/target/${godname}-${project.artifactId}.tar</tar>
</outputPaths>
<container>
<mainClass>net.nice.box.gateway.GatewayApplication</mainClass>
<!--使用当前时间-->
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
<jvmFlags>
<!-- <jvmFlag>-Xms512m</jvmFlag>-->
<!-- <jvmFlag>-Xmx2048m</jvmFlag>-->
<jvmFlag>-XX:+UseContainerSupport</jvmFlag>
<jvmFlag>-XX:-UseAdaptiveSizePolicy</jvmFlag>
<jvmFlag>-XX:InitialRAMPercentage=40.0</jvmFlag>
<jvmFlag>-XX:MinRAMPercentage=20.0</jvmFlag>
<jvmFlag>-XX:MaxRAMPercentage=80.0</jvmFlag>
<jvmFlag>-Duser.timezone=GMT+08</jvmFlag>
<jvmFlag>-Duser.timezone=GMT+08</jvmFlag>
</jvmFlags>
<environment>
<TZ>Asia/Shanghai</TZ>
<spring.profiles.active>deploy</spring.profiles.active>
</environment>
</container>
<!--如果私有镜像仓库没有启用https,设置allowInsecureRegistries参数为true-->
<allowInsecureRegistries>true</allowInsecureRegistries>
</configuration>
<!--绑定jib:build到 Maven生命周期,例如package-->
<executions>
<execution>
<phase>${project.jib-tar}</phase>
<goals>
<goal>buildTar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>