#使用jib-maven-plugin <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> </configuration> </plugin> <plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>jib-maven-plugin</artifactId> <version>2.2.0</version> <configuration> <from> <image>registry.cn-shanghai.aliyuncs.com/starxin/docker-jib:1.0</image> </from> <to> <image>生成的镜像地址</image> <tags> <tag>latest</tag> </tags> <auth> <username>登录账号</username> <password>登录密码</password> </auth> </to> <container> <ports> <port>8080</port> </ports> <args> <arg>--spring.profiles.active=prod</arg> </args> </container> <allowInsecureRegistries>true</allowInsecureRegistries> </configuration> </plugin> </plugins> </build>
生成并推送镜像 点击-jib:build