Docker Community Forums

Share and learn in the Docker community.

Multi-arch autobuilds

Good morning,

I am trying to set up a multi-arch automated build set up. Once a new version tag gets pushed to my github repository, I want to build a set of images for all the supported architectures and then create a manifest list for all them.
Right now, I have set 10 custom autobuild rules:

  • Source type: Tag
  • Source: /^latest$|^\d+(?:\.\d+)*(?:\.x)?(?:-[-\w]*)?$/
  • Docker tag: OS-ARCH-{sourceref}
  • Dockerfile location: build/package/OS/ARCH/Dockerfile
  • Build context: /
  • Autobuild: yes
  • Build caching: yes

Where OS and ARCH are different for each of the 10 autobuilds. As you can see I have to mantain 10 rules, 10 dockerfiles and if I want to implement hooks I would also have to keep 10 copies of them.

Afterwards I’m manually executing a local script that uses docker manifest create ..., 10 docker manifest annotate ... and docker manifest push ... to create the manifest list for the 10 images. I am unable to run this script in a hook as I do not know beforehand which of the 10 autobuilds will finish last.

I was considering moving to a single autobuild rule and using a build hook to build all the archs. Afterwards, a post-push hook will create the manifest and push it to the repository. Would this approach be viable? To do this I need to find the default hooks that are being used, in order to modify them for multiple os-arch combinations. Are the default implementations of the hooks available somewhere?

Thank you in advance