docker / docker/build-push-action
Build multi-platform images that build on each other
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 735
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 14
Description
Description
Scenario
I'm trying to use this action to build, for multiple platforms, a pair of images, e.g. foo-base and foo-specialized. foo-specialized uses foo-base as a base image, e.g.:
FROM foo-base:latest
# ...
I'd like to perform builds on both PRs and on my main branch:
- On PRs, I'll push a tag based on the Git SHA
- On the main branch, I'll push both the
latesttag and a tag based on the Git SHA
Attempt
My initial attempt was just this:
- name: Build and push foo-base
uses: docker/build-push-action@v6
with:
context: path/to/base
platforms: linux/amd64,linux/arm64
push: true
no-cache: true
tags: foo-base:${{ github.event.pull_request.head.sha || github.sha }}
- name: Build and push foo-specialized
uses: docker/build-push-action@v6
with:
context: path/to/specialized
platforms: linux/amd64,linux/arm64
push: true
no-cache: true
tags: foo-specialized:${{ github.event.pull_request.head.sha || github.sha }}
However, this didn't work as there wasn't a latest tag for foo-base. So I tried changing things to load the image back into Docker and tag it as latest (I can't specify ...:latest in tags: because I don't want the latest tag pushed to Docker Hub for PR branches):
- name: Build and push foo-base
uses: docker/build-push-action@v6
with:
context: path/to/base
platforms: linux/amd64,linux/arm64
push: true
load: true
no-cache: true
tags: foo-base:${{ github.event.pull_request.head.sha || github.sha }}
- name: Tag foo-base as latest
run: docker tag foo-base:${{ github.event.pull_request.head.sha || github.sha }} foo-base:latest
- name: Build and push foo-specialized
uses: docker/build-push-action@v6
with:
context: path/to/specialized
platforms: linux/amd64,linux/arm64
push: true
no-cache: true
tags: foo-specialized:${{ github.event.pull_request.head.sha || github.sha }}
However, that fails because of https://github.com/docker/buildx/issues/59. The recommended solution for that was to use the containerd image store, but I don't see any documentation in this action about how to set that up or use it for image loading/exporting.
Question
Can you recommend any way to achieve what I want? It seems like using the containerd image store would be the way to go, but as I mentioned above, there's no documentation on this action about how to use it. Do you have any advice? Let me know if this is better suited to be a discussion, or if I should turn this into a concrete feature request, e.g. "let me configure this action to use containerd as the image store".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the workflow examples using docker/build-push-action@v6, especially the multi-platform build, load, and tagging steps. Review the linked buildx issue and the action's existing documentation for image loading and exporting with the containerd image store. Done means the supported setup or limitation is documented clearly enough to reproduce the dependent-image workflow, or the needed feature is scoped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, github-actions
- Domain
- build-system, ci-cd, devops
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100