Quarkus - Container Images
The extension is powered by for performing container image builds. The major benefit of using Jib with Quarkus is that all the dependencies (everything found under target/lib
) are cached in a different layer than the actual application making rebuilds really fast and small (when it comes to pushing). Another important benefit of using this extension is that it provides the ability to create a container image without having to have any dedicated client side tooling (like Docker) or running daemon processes (like the Docker daemon) when all that is needed is the ability to push to a container image registry.
To use this feature, add the following extension to your project:
Including extra files
There are cases when additional files (other than ones produced by the Quarkus build) need to be added to a container image. To support these cases, Quarkus copies any file under src/main/jib
into the built container image (which is essentially the same idea that the Jib Maven and Gradle plugins support). For example, the presence of src/main/jib/foo/bar
would result in /foo/bar
being added into the container filesystem.
Docker
To use this feature, add the following extension to your project.
The extension quarkus-container-image-s2i
is using S2I binary builds in order to perform container builds inside the OpenShift cluster. The idea behind the binary build is that you just upload the artifact and its dependencies to the cluster and during the build they will be merged to a builder image (defaults to fabric8/s2i-java
).
The benefit of this approach, is that it can be combined with OpenShift’s DeploymentConfig
that makes it easy to roll out changes to the cluster.
To use this feature, add the following extension to your project.
S2I builds require creating a BuildConfig
and two ImageStream
resources, one for the builder image and one for the output image. The creation of such objects is being taken care of by the Quarkus Kubernetes extension.
To build a container image for your project, quarkus.container-image.build=true
needs to be set using any of the ways that Quarkus supports.
It does not make sense to use multiple extension as part of the same build. When multiple container image extensions are present, an error will be raised to inform the user. The user can either remove the uneeded extensions or select one using .
For example, if both container-image-docker
and container-image-s2i
are present and the user needs to use container-image-docker
:
quarkus.container-image.builder=docker
The following properties can be used to customize the container image build process.
Container Image Options
In addition to the generic container image options, the container-image-jib
also provides the following options:
Docker Options
In addition to the generic container image options, the container-image-docker
also provides the following options:
In addition to the generic container image options, the container-image-s2i
also provides the following options: