Skip to content

Speedup docker build in CI#723

Open
evgeny-stakewise wants to merge 4 commits into
masterfrom
docker-matrix-build
Open

Speedup docker build in CI#723
evgeny-stakewise wants to merge 4 commits into
masterfrom
docker-matrix-build

Conversation

@evgeny-stakewise
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 8, 2026 17:58
Comment on lines 7 to +91
@@ -35,20 +43,87 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
- name: Build and push by digest
id: build
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=image,"name=europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator,stakewiselabs/v3-operator",push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: digests-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

docker-merge:
name: Merge Docker Manifests
needs: docker
runs-on: ubuntu-latest
steps:
- name: Download digests
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Docker meta
id: meta
uses: docker/metadata-action@b2391d37b4157fa4aa2e118d643f417910ff3242 # v3
with:
images: |
europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator
stakewiselabs/v3-operator
flavor: |
latest=auto
tags: |
type=ref,event=branch
type=ref,event=tag
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Docker GitHub Actions workflow to reduce CI build time by building amd64 and arm64 images in parallel on architecture-appropriate runners, then merging them into multi-arch manifests.

Changes:

  • Convert the Docker build job into a matrix that builds/pushes per-platform images by digest on separate runners.
  • Add a follow-up job to download per-platform digests and create/push multi-arch manifests for both GAR and Docker Hub.
  • Update the Trivy scan job to wait for the manifest-merge job instead of the per-platform build job.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings May 8, 2026 18:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/docker.yaml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants