diff --git a/src/main/asciidoc/inc/build/_buildx.adoc b/src/main/asciidoc/inc/build/_buildx.adoc index 9de241744..a5d737ab3 100644 --- a/src/main/asciidoc/inc/build/_buildx.adoc +++ b/src/main/asciidoc/inc/build/_buildx.adoc @@ -1,9 +1,15 @@ [[build-buildx]] -Buildx is enabled by setting the `` section of buildx configuration. Only the native platform -built and loaded into the local repository by the build goal. All specified platforms are built and -pushed by the push goal. +Buildx is enabled when there is a non-empty `` element inside the `` configuration. Only the native platform +is built and saved in the local image cache by the `build` goal. All specified platforms are built and pushed into the remote +repository by the `push` goal. This behavior is to prevent non-native images from tainting the local image cache. + +The local image cache cannot hold multi-architecture images nor can it have two platform specific images of the same name. The +recommended `` configuration is to specify all supported platforms, including the native platform, in the `` +element. This allows local integration testing of the build image from the local cache. During install or deploy phase, the +build machine will build and push all images to the registry. Any downstream consumers, regardless of native architecture, will +be able to use the multi-architecture image. The `` element within `` defines how to build multi-architecture images. @@ -28,6 +34,45 @@ Non-absolute files are relative to the maven project directory. If dockerConfigD is relative to the user's home directory. | *platforms* -| A list of `` elements specifying platform to build. A platform has syntax of `OS/architecture` (e.g. linux/amd64, linux/arm64, darwin/amd64). +| A list of `` elements specifying platform to build. A platform has syntax of `OS/architecture` (e.g. linux/amd64, +linux/arm64, darwin/amd64). Each `` element may have a comma separated list of platforms. Empty `` +elements are ignored. If no platform architecture is specified, buildx is *not* used. You can use + +|=== + +.Examples +The recommended configuration is setting a top level property with the list of platforms to build. + +[source,xml] +---- + + + +---- + +Then in the image configuration, use the following; + +[source,xml] +---- + + + + ${project.groupId}.${project.artifactId} + + + + ${docker.platforms} + + + + + + + +---- -|=== \ No newline at end of file +You can now override the built platforms using a command line define: +[source,bash] +---- +mvn clean deploy -Ddocker.platforms=linux/amd64,linux/arm64 +---- \ No newline at end of file