Swagger-ui: Crossbuilding docker image for different architectures

Created on 30 Jan 2020  Â·  2Comments  Â·  Source: swagger-api/swagger-ui

### Content & configuration
Docker image should work on most common processor architectures.

Is your feature request related to a problem?

The image only works on the architecture with which it was built.
Now docker image only works on x86-64 (maybe only x64).
Docker image not working on Raspberry PI at least.

➜  ~ arch
armv7l
➜  ~ docker run -it swaggerapi/swagger-ui sh
standard_init_linux.go:211: exec user process caused "exec format error"
➜  ~ arch 
x86_64
➜  ~ docker run -it swaggerapi/swagger-ui sh -c "echo 'works well'"
works well

Describe the solution you'd like

Something like

docker buildx build \
  --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x \
  --output "type=image,push=false" \
  --file ./Dockerfile \
  --pull \
  --tag swaggerapi/swagger-ui:latest \
  .

Describe alternatives you've considered

https://docs.docker.com/engine/reference/commandline/manifest_create/

Additional context

docker buildx imagetools inspect nginx:1.17-alpine
Base image works on linux/amd64, linux/arm/v6, linux/arm64/v8, linux/386, linux/ppc64le, linux/s390x.
Swagger UI image not event annotated
docker buildx imagetools inspect swaggerapi/swagger-ui

Most helpful comment

I wrote Github Actions pipeline for crossbuilding swagger-ui image to 386, amd64, arm/v6, arm/v7, arm64, s390x architectures.
https://github.com/Pentusha/swagger-ui/blob/master/.github/workflows/docker_crossbuild.yml
It publish result images to Docker Hub:
https://hub.docker.com/repository/docker/pentusha/swagger-ui-crossbuild/general
Its works fine on my raspberry pi 4.

arch; docker run -it pentusha/swagger-ui-crossbuild:latest sh -c 'echo "works well"'
armv7l
works well

Maybe you could include this build steps to your Jenkins pipelines.

All 2 comments

I wrote Github Actions pipeline for crossbuilding swagger-ui image to 386, amd64, arm/v6, arm/v7, arm64, s390x architectures.
https://github.com/Pentusha/swagger-ui/blob/master/.github/workflows/docker_crossbuild.yml
It publish result images to Docker Hub:
https://hub.docker.com/repository/docker/pentusha/swagger-ui-crossbuild/general
Its works fine on my raspberry pi 4.

arch; docker run -it pentusha/swagger-ui-crossbuild:latest sh -c 'echo "works well"'
armv7l
works well

Maybe you could include this build steps to your Jenkins pipelines.

Would like to see ARM64 support :)
Thank you to share your config. If we can enable Github Action pipeline for crossbuilding and testing in this upstream project, I think it's better.

Was this page helpful?
0 / 5 - 0 ratings