jib-maven-plugin's default example runs the build goal during the package phase.
The build goal will push the docker image to the remote registry, which may be too frequent to run in the package phase for some projects.
This template instead configures the jib-maven-plugin to run the following goals in the following phases:
| Phase | Goal | Goal Description |
|---|---|---|
| package | buildTar | Build docker image as tar file |
| install | dockerBuild | Build docker image and install in Docker daemon |
| deploy | build | Build docker image and push to remote Docker registry |
which is more in-line with the definition of each phase.
This template also provides sensible defaults like using the project groupId and artifactId to construct the docker image name, and using the project version as the Docker image tag.
The reason why the to.image configuration cannot be shared between the install and push executions, is because the dockerBuild goal will also push to the remote Docker registry if the to.image configuration is prefixed with the registry hostname.
Written with jib-maven-plugin version 1.8.0.