Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
02c4815
docker-build-push-multiarch initial commit
ricky-undeadcoders Sep 17, 2025
1f88d59
Docs updates for docker-build-push-multiarch
ricky-undeadcoders Sep 18, 2025
6676b64
update to point to new composite action branch
ricky-undeadcoders Sep 19, 2025
50d38af
Convert merge-digest to run when push is false (handled in action)
ricky-undeadcoders Sep 19, 2025
ff71e87
remove delete-credentials-file input
ricky-undeadcoders Sep 20, 2025
5da7873
Readme link updates
ricky-undeadcoders Sep 23, 2025
b8fc9ed
Update inputs to match downstream docker-build-push-image composite a…
ricky-undeadcoders Sep 23, 2025
079fa9a
Update help text and platform mapping strategy for docker-build-push-…
ricky-undeadcoders Oct 2, 2025
d115ea5
Update help text and platform mapping strategy for docker-build-push-…
ricky-undeadcoders Oct 2, 2025
cea52cc
Update help text and platform mapping strategy for docker-build-push-…
ricky-undeadcoders Oct 2, 2025
6db513e
Update help text and platform mapping strategy for docker-build-push-…
ricky-undeadcoders Oct 2, 2025
c5804b6
Update help text and platform mapping strategy for docker-build-push-…
ricky-undeadcoders Oct 2, 2025
6423d07
Update help text and platform mapping strategy for docker-build-push-…
ricky-undeadcoders Oct 2, 2025
0905834
Update help text and platform mapping strategy for docker-build-push-…
ricky-undeadcoders Oct 2, 2025
96a5335
Update help text and platform mapping strategy for docker-build-push-…
ricky-undeadcoders Oct 2, 2025
f372797
Update help text and platform mapping strategy for docker-build-push-…
ricky-undeadcoders Oct 2, 2025
757331f
Fix missing metadata in docker-import-digests-push-manifest
ricky-undeadcoders Oct 8, 2025
ff28a38
apply recommended changes
ricky-undeadcoders Oct 10, 2025
5ed9d1c
add spellcheck disable
ricky-undeadcoders Oct 10, 2025
9f72d18
update docs
ricky-undeadcoders Oct 11, 2025
f927b01
Fix composite action references
ricky-undeadcoders Oct 15, 2025
bc10c94
pin docker action shas
ricky-undeadcoders Oct 15, 2025
c0d5807
remove pre and post build steps
ricky-undeadcoders Oct 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/docker-build-push-multiarch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# docker-build-push-multiaarch

This is a reusable workflow that uses Grafana's hosted runners to natively build and push multi-architecture docker
images.

Right now this supports pushing images to:

- Google Artifact Registry
- DockerHub

And supports building the following image types:

- linux/arm64
- linux/amd64

## How it works

This generates a matrix based off of the `platforms` input, then creates a job per platform that runs the composite
actions [docker-build-push-image] and [docker-export-digest] to build and push docker images, and capture their digests.
There is then a final job that runs the composite action [docker-import-digests-push-manifest] to push the docker
manifest.

[docker/build-push-action]: https://github.com/docker/build-push-action
[docker-build-push-image]: ../../docker-build-push-image/README.md
[docker-export-digest]: ../../docker-export-digest/README.md
[docker-import-digests-push-manifest]: ../../docker-import-digests-push-manifest/README.md

<!-- x-release-please-start-version -->

```yaml
name: Build and Push and Push MultiArch

on: push

jobs:
build-push-multiarch:
uses: grafana/shared-workflows/.github/workflows/build-and-push-docker-multiarch.yml@rwhitaker/multi-arch-builds # TODO: Pin to version
with:
platforms: linux/arm64,linux/amd64
tags: |
${{ github.sha }}
rickytest
push: true
registries: "gar,dockerhub"
pre-build-script: scripts/ci-build.sh
```

<!-- x-release-please-end-version -->

## Inputs

| Name | Type | Description |
| ----------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `build-args` | string | List of arguments necessary for the Docker image to be built. Passed to `docker/build-push-action`. |
| `build-contexts` | string | List of additional build contexts (e.g., name=path). Passed to `docker/build-push-action`. |
| `buildkitd-config` | string | The buildkitd config file to use. Defaults to `/etc/buildkitd.toml` if you're using Grafana's self-hosted runners. Passed to `docker/setup-buildx-action`. |
| `buildkitd-config-inline` | string | The buildkitd inline config to use. Passed to `docker/setup-buildx-action`. |
| `cache-from` | string | Where cache should be fetched from. Passed to `docker/build-push-action`. |
| `cache-to` | string | Where cache should be stored to. Passed to `docker/build-push-action`. |
| `context` | string | Path to the Docker build context. Passed to `docker/build-push-action`. |
| `docker-buildx-driver` | string | The driver to use for Docker Buildx. Passed to `docker/setup-buildx-action`. |
| `dockerhub-registry` | string | DockerHub Registry to store docker images in. |
| `dockerhub-repository` | string | DockerHub Repository to store docker images in. Default: github.repository |
| `file` | string | The dockerfile to use. Passed to `docker/build-push-action`. |
| `gar-delete-credentials-file` | string | Delete the Google credentials file after the action is finished. If you want to keep the credentials file for a later step, set this to false. |
| `gar-environment` | string | Environment for pushing artifacts (can be either dev or prod). This sets the GAR Project (gar-project) to either `grafanalabs-dev` or `grafanalabs-global`. |
| `gar-image` | string | Name of the image to build. Default: `${GitHub Repo Name}`. |
| `gar-registry` | string | Google Artifact Registry to store docker images in. |
| `gar-repository` | string | Override the 'repo_name' used to construct the GAR repository name. Only necessary when the GAR includes a repo name that doesn't match the GitHub repo name. Default: `docker-${GitHub Repo Name}-${gar-environment}` |
| `include-tags-in-push` | string | Disables the pushing of tags, and instead includes just a list of images as docker tags. Used when pushing docker digests instead of docker tags. |
| `labels` | string | List of custom labels to add to the image as metadata (passed to `docker/build-push-action`). Passed to `docker/build-push-action`. |
| `load` | string | Whether to load the built image into the local docker daemon (passed to `docker/build-push-action`). Passed to `docker/build-push-action`. |
| `outputs` | string | List of docker output destinations. Passed to `docker/build-push-action`. |
| `platforms` | string | List of platforms to build the image for. Passed to `docker/build-push-action`. |
| `post-build-script` | string | A script to run after `docker build` |
| `pre-build-script` | string | A script to run before `docker build` |
| `push` | string | Whether to push the image to the configured registries. Passed to `docker/build-push-action`. |
| `registries` | string | CSV list of registries to build images for. Accepted registries are "gar" and "dockerhub". |
| `secrets` | string | Secrets to expose to the build. Only needed when authenticating to private repositories outside the repository in which the image is being built. Passed to `docker/build-push-action`. |
| `server-size` | string | Size of the Grafana self-hosted runner |
| `ssh` | string | List of SSH agent socket or keys to expose to the build Passed to `docker/build-push-action`. |
| `tags` | string | List of Docker tags to be pushed. Passed to `docker/build-push-action`. |
| `target` | string | Sets the target stage to build. Passed to `docker/build-push-action`. |

## Outputs

| Name | Type | Description |
| --------------- | ------ | ------------------------------------------------------------------------ |
| `annotations` | String | Generated annotations (from docker/metadata-action) |
| `digest` | String | Image digest (from docker/build-push-action) |
| `imageid` | String | Image ID (from docker/build-push-action) |
| `images` | String | Comma separated list of the images that were built |
| `json` | String | JSON output of tags and labels (from docker/metadata-action) |
| `labels` | String | Generated Docker labels (from docker/metadata-action) |
| `metadata` | String | Build result metadata (from docker/build-push-action) |
| `runner_arches` | String | The list of OS used to build images (for mapping to self hosted runners) |
| `tags` | String | Generated Docker tags (from docker/metadata-action) |
| `version` | String | Generated Docker image version (from docker/metadata-action) |
Loading
Loading