HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerMinor

Use buildx in Jenkinsfile for platform specific build

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
platformjenkinsfilebuildxforspecificusebuild

Problem

I'm currently building my docker image declaratively in a Jenkinsfile by:

app = docker.build("...")


Now I need to generate a platform specific build for ARM64.
For this purpose

docker buildx build --platform linux/arm64 ...


must be used.

I there a way to keep using the docker.build() syntax and still generate a platform specific image?

Or do I have to rewrite the syntax, if then how?

Solution

The Jenkins Docker Pipeline plugin does not support buildx (yet?). Voting may help, so add yours to the issue if so inclined.

Jeremie Drouet wrote a great post "Multi-arch build and images, the simple way" which covers the underlying ways you can do it by building images first, then create a manifest to link them together.

bgulla on Github has a gist that does as much of the build as possible with pipeline using docker.withRegistry(). Then uses sh to create and push the manifest.

Context

StackExchange DevOps Q#15267, answer score: 2

Revisions (0)

No revisions yet.