#Multi-platform image with GitHub Actions

1 messages ยท Page 1 of 1 (latest)

icy drum
#

I'd move this over to a Dagger Module (it's in the older SDK style) and allow the platform os/arch combo to be an argument. Sounds like you're well on your way there.

You'll want to use like want to use platformVariants to assemble the final manifest...looking for example

steep island
#

Thanks I'll take a look at that!

icy drum
#

https://github.com/jpadams/cullen/actions/runs/8979233059

So in the build-push-single job, the GitHub Actions matrix called dagger call build-push 4 times, once for each platform on a native machine, then the pull-push-multi job waited until those were done ( needs: build-push-single in GHA yaml) and put together the multi-platform image by pulling all the other ones and putting togther a multi-platform image, then pushing it.

#

I used ttl.sh instead of DockerHub or ECR or whatever, but it will give you a sense of what's possible, I hope ๐Ÿ™‚

icy drum
#

You can run the same sort of thing locally like this (showing 2 platforms instead of all 4)

export DAGGER_MODULE="github.com/jpadams/cullen"
dagger call build-push --image foobar --platform "linux/arm64" --tag "0.0.1"
dagger call build-push --image foobar --platform "linux/amd64" --tag "0.0.1"

dagger call multi-push --image foobar --platforms="linux/arm64,linux/amd64" --tag "0.0.1"
#
# fun to inspect the resulting multi-platform image
dagger call multi-push --image foobar --platforms="linux/arm64,linux/amd64" --tag "0.0.1" | xargs -I {} docker buildx imagetools inspect {}
#

In my particular case

Name:      ttl.sh/foobar:0.0.1@sha256:75115eebb71f27e5af0287200e2cc47ae6b09c0035878749608d92776ac416f7
MediaType: application/vnd.oci.image.index.v1+json
Digest:    sha256:75115eebb71f27e5af0287200e2cc47ae6b09c0035878749608d92776ac416f7

Manifests:
  Name:      ttl.sh/foobar:0.0.1@sha256:2b8dab733141ec9444e0b2952c890ef9f8b843637ac58fa6a5c6fa0b87dc4f7c
  MediaType: application/vnd.oci.image.manifest.v1+json
  Platform:  linux/arm64

  Name:      ttl.sh/foobar:0.0.1@sha256:22fe6e5d4d8c25ccd4fb45eca9e6a792e744451fa5cd7eea85f555da60af5687
  MediaType: application/vnd.oci.image.manifest.v1+json
  Platform:  linux/amd64
#

@strong dove @latent cloak @glacial surge fun example ๐Ÿ‘†

icy drum
#

Thanks again for bringing this up @steep island ๐Ÿ™
Through this process we found a subtle bug (worked around in my example) that we fixed https://github.com/dagger/dagger/pull/7298 and will be in the next release of Dagger: Tomorrow ๐Ÿ™Œ ๐Ÿ˜ ๐ŸŒˆ

GitHub

always resolves to the target image platform to set the Container
platform.
we're currently defaulting to the defaultPlatform if ContainerOpts.Platform is not set when creating the container.
...