ci: add Docker registry cache via GHCR for faster CI builds#879
Open
IgnatovFedor wants to merge 13 commits intoupgrade-v0.2.11from
Open
ci: add Docker registry cache via GHCR for faster CI builds#879IgnatovFedor wants to merge 13 commits intoupgrade-v0.2.11from
IgnatovFedor wants to merge 13 commits intoupgrade-v0.2.11from
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to speed up GitHub Actions CI by enabling cross-run Docker layer reuse via docker buildx and a GHCR-backed registry cache, reducing cold-start rebuild time for the build-images job.
Changes:
- Switched multiple component builds from
docker buildtodocker buildx buildand introduced aUSE_REGISTRY_CACHEflag to opt into registry-backed caching. - Updated the reusable CI workflow to set up Buildx, authenticate to GHCR, and build images with registry cache enabled.
- Added
packages: writepermission to the integration workflow to support pushing cache layers to GHCR.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| proxy/Makefile | Adds Buildx + registry cache args for proxy image builds. |
| proxy-ssl/Makefile | Adds Buildx + registry cache args for proxy-ssl image builds. |
| bridge/Makefile | Adds Buildx + registry cache args for bridge image builds. |
| inference-chain/Makefile | Adds registry cache args for inferenced builds and upgrade build output. |
| decentralized-api/Makefile | Adds Buildx + registry cache args for api builds and upgrade build output. |
| decentralized-api/Dockerfile | Removes an ARG related to build flags (affects build-arg usage). |
| Makefile | Adds Buildx + registry cache args for mock-server image build. |
| .github/workflows/test-workflow.yml | Sets up Buildx + GHCR login; enables registry cache during CI image builds. |
| .github/workflows/integration.yml | Grants packages: write to allow cache export to GHCR. |
Comments suppressed due to low confidence (1)
decentralized-api/Dockerfile:12
BUILD_FLAGSis still passed fromdecentralized-api/Makefilevia--build-arg BUILD_FLAGS=..., but after removingARG BUILD_FLAGSit will be ignored by Docker. Also, the build step uses-ldflags "$LDFLAGS"but there is noARG/ENV LDFLAGSdeclared in this Dockerfile, so ldflags will always be empty. To keep version/commit injection working, reintroduce and use the appropriate build arg (either declareARG BUILD_FLAGSand use it, or switch to an explicitARG LDFLAGSand pass that).
FROM golang:1.24.2-alpine3.20 AS builder
ARG GOOS
ARG GOARCH
ARG BLST_PORTABLE=0
ENV GOOS=${GOOS} \
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docker registry cache for GitHub Actions
What problem does this solve?
CI builds cold-start every run - Docker layers are rebuilt from scratch each time, making the build-images job unnecessarily slow. Issue #338.
How do you know this is a real problem?
build-images is the bottleneck in CI; no layer reuse happens between runs on ephemeral GitHub-hosted runners.
How does this solve the problem?
Switches all component Makefiles from
docker buildtodocker buildx buildand adds aUSE_REGISTRY_CACHEflag. When set to1, each build passes--cache-fromand--cache-topointing at a dedicatedghcr.io/gonka-ai/<component>:buildcachetag. The CI workflow authenticates to GHCR before building and passesUSE_REGISTRY_CACHE=1.What risks does this introduce? How can we mitigate those risks?
mode=maxwhich stores all layers and by the fact that cache misses fall back to a full build.How do you know this PR fixes the problem?
In the second run make images in integration tests took 5.5 minutes instead of 14.5 minutes on the firs run.