I want to build and publish a docker image using spring-boot-maven-plugin
. I don't want to use a different tool to accomplish this.
I'm able to get it to both build and publish during package phase, or build and publish during deploy phase.
To do both things at package phase, I have this:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-image</goal>
</goals>
<configuration>
<image>
<publish>true</publish>
</configuration>
</execution>
</executions>
</plugin>
To have both things at deploy phase, I can add <phase>deploy</phase
.
I'd like to be able to build the image during package phase, so I can run mvn package
and test it locally, and then publish the image during deploy phase.
How can I separate the build and publish out?
Note that it shouldn't rebuild the docker image if I run mvn package
followed by mvn deploy
.