← Back to issue list

docker: setup a multiarch build for snapcraft docker images

View original Github issue

Metadata

Project
snapcraft
Number
#3144
Type
pull request
State
closed
Author
adferrand
Labels
—
Created
Updated
Closed

Current evaluation

PR #3144 (multiarch snapcraft Docker images via QEMU) was closed unmerged by sergiusens in Dec 2020, since the base-image change (focal/core20) would break existing CI users; Docker images were being moved to a separate repo.

Resolution: closed superseded

Reason: Maintainer sergiusens closed the PR without merging on 2020-12-15, stating the Docker images would be hosted in a new separate repository created by cjp256, and that this PR would be referenced there. The in-tree docker/ images were later removed entirely by merged PR #4109 (commit eb0bf1276).

Evaluated by: mr-cal-bot

No scores available.

Issue body

Hello! During my work to build the certbot snap (Python based) for multiple architectures (see https://github.com/certbot/certbot/pull/8016), I searched a way to execute snapcraft on each target architecture. Running `snapcraft` on the native architecture or through emulation is necessary since the snap Python plugin is not able to make cross-compilation, on the contrary of Go for instance that has this feature at its core in the Go compiler. To be able to execute this workflow on a CI pipeline (that is running mostly on `amd64`), I choose to use QEMU. Doing so is done best through the `snapstore/snapcraft` docker image, since QEMU is quite well supported on this technology. As a consequence I ended up rewriting the `snapstore/snapcraft` docker image with QEMU embedded and create it for each target architecture to let that happen. I think it could be useful to other for similar cross-compilation purposes, and more generally to be able to run the snapcraft docker image on more architectures. This PR proposes the cross-compilation of the docker image for 4 platforms (linux/amd64, linux/386, linux/arm64 and linux/arm/v7) through QEMU using a host on linux/amd64. Appropriate hooks and scripts are added to allow this cross-compilation to happen on Docker Hub Autobuild. On top of it, a multiarch manifest takes place on `snapstore/snapcraft:RISK`, so that any user can target this tag during a `docker pull`, and get the appropriate architecture without explicitly asking for it. I take also the occasion to merge the 4 Dockerfiles into one thanks to the `ARG` feature. You can see the result of this on my fork here: https://hub.docker.com/r/adferrand/snapcraft/tags At the end, 5 tags are pushed: one for each architecture, and one that is a manifest and refer to each architecture. As a side note, a lot of the logic added in this PR is to cover the lack of features on Docker Hub Autobuild, that uses (ironically) and ancient version of Docker engine. With more recents versions you can take advantaged of of `docker buildx`, that leverages almost all the complexity to cross-compiling. If you are interested in using Travis instead of Docker Hub Autobuild, I will be glad to write the logic! --- - [X] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh tests/unit`?

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed superseded PR #3144 (multiarch snapcraft Docker images via QEMU) was closed unmerged by sergiusens in Dec 2020, since the base-image change (focal/core20) would break existing CI users; Docker images were being moved to a separate repo.
stealth/space-bunny-alpha — closed superseded PR #3144 (adferrand) rewrote the snapstore/snapcraft Dockerfiles with QEMU multiarch (amd64/386/arm64/armv7) builds via Docker Hub Autobuild. Closed unmerged 2020-12-15 by sergiusens, who worried it would break CI since images moved to focal/core20.
stealth/space-bunny-alpha — closed superseded PR #3144 proposed multiarch (amd64/386/arm64/armv7) QEMU-based builds of the snapcraft docker images. Maintainer sergiusens closed it unmerged on 2020-12-15, noting the images would move to a separate repo.
stealth/space-bunny-alpha — closed superseded PR #3144 was closed unmerged and redirected to a planned separate Docker-image repository after concerns that base-OS changes would break existing CI.
stealth/space-bunny-alpha — closed superseded Closed without merging in December 2020 because replacing Ubuntu 16.04 images with Focal/core20 would break CI for base-less snaps; Docker images were moved to a separate repository.
qwen/qwen3.6-35b-a3b — — Closed and superseded due to concerns about breaking CI with base OS changes. Maintainer redirected Docker image maintenance to a new dedicated repository, referencing this PR there instead.
qwen3.6-35b-a3b-mtp-q6 — — Closed and superseded. Maintainer rejected merging due to breaking CI from base image changes. The changes were referenced in a newly created separate repository for Docker images.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#2673 (confidence 85%)

    Earlier PR referenced by a reviewer for parametrizing risk and OS in Docker image builds.

  • Superseded By: snapcraft#4109 (confidence 70%)

    Merged PR removing the outdated docker/Dockerfile from the snapcraft tree, confirming images moved out of this repo.

  • Related To: snapcraft#2672 (confidence 40%)

    Other docker image maintenance merged around the same period.

Related issues

Issue Project State Summary Similarity
#2245 docker: support for testing snapcraft in proposed snapcraft merged Merged in #2245 via commit 4a3095548, adding a xenial-proposed Docker image for testing the Snapcraft deb and removing an unnecessary multiverse edit.
71%