acoustic-carpenter-78188
04/23/2026, 6:57 PMdocker/devbox-bundled/Makefile invokes docker buildx build three times (the per-arch flyte-binary build, the main devbox image, and the GPU variant) without any --cache-from / --cache-to flags. `.github/workflows/flyte-binary-v2.yml`'s Export ARM64 Image / Export AMD64 Image steps were also uncached. As a result, fresh checkouts, CI runners, and repeated local builds always start cold — the expensive stages in the Dockerfile (image preloading, bootstrap compilation, embedded-postgres fetch, frontend bundle) are recomputed from scratch every time.
What changes were proposed in this pull request?
Three linked changes:
1. Makefile pass-through knobs — expose BUILDX_CACHE_FROM / BUILDX_CACHE_TO that append --cache-from / --cache-to to every docker buildx build invocation (per-arch flyte-binary, build, build-gpu). Leaving them unset disables caching.
2. Smart defaults — detect the execution environment:
• $(GITHUB_ACTIONS) == true → default to type=gha with scope flyte-devbox for the image and flyte-binary-<arch> for each per-arch binary build.
• Otherwise → default to type=local under $(BUILDX_CACHE_DIR) (defaults to $HOME/.cache/flyte-devbox-buildx), with per-arch subdirectories for the binary build.
• User overrides via command line or environment (detected with $(origin ...)) take precedence uniformly across all three buildx calls.
3. CI workflow — add cache-from / cache-to: type=gha with per-arch scopes (flyte-binary-arm64, flyte-binary-amd64) to the Export ARM64 Image, Export AMD64 Image, and final multi-arch push steps in flyte-binary-v2.yml. docker/setup-buildx-action is already present and propagates the required ACTIONS_CACHE_URL / ACTIONS_RUNTIME_TOKEN automatically.
The per-arch binary build runs twice per invocation (amd64, then arm64). Auto-scoping each arch separately prevents the second build from clobbering the first's cache.
How was this patch tested?
make -n verified flag rendering in four modes: GHA default, local default, custom override, and disabled.
GHA benchmark on this PR branch (real runs)
Measured on GitHub-hosted ubuntu-latest runners. Baseline is the average of the last 6 successful v2 push runs. "Cold fill" = first run on this PR (empty gha scopes; cache upload overhead). "Warm hit" = re-run of the same workflow after scopes are populated.
| Job | v2 baseline (avg, 6 runs) | PR cold-fill | PR warm-hit |
| ----------------------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------- | ----------- |
| test-bootstrap | ~50 s | 30 s | 28 s |
| build-and-push-single-binary-image | 5.8 min | 9.3 min | 35 s |
| build-and-push-devbox-bundled-image | 2–13 min (bimodal; existing demo-cpu/demo-gpu cache) | n/a (transient GitHub cache-service 500 on pre-existing demo-gpu step) | 1.5 min |
• build-and-push-single-binary-image goes from 5.8 min → 35 s on a warm run (~10×). Cold fill is ~3.5 min slower than baseline (one-time cost to upload cache); breaks even after a single reuse.
• build-and-push-devbox-bundled-image already had type=gha cache before this PR, so no regression there.
Local benchmark (Makefile defaults, type=local cache)
Both runs executed on this branch via make build in docker/devbox-bundled/. BuildKit's in-container cache is pruned between runs so the external type=local cache is the only reuse path.
| Run | Local cache dir | Wall-clock |
| --------- | ---------------------- | ------------ |
| cold-fill | empty | 7 min 18 s |
| warm-hit | populated by cold-fill | 2 min 17 s |
~3.2× speedup / 5 min 1 s saved per subsequent local build after any docker buildx prune.
Labels
changed
Check all the applicable boxes
• All commits are signed-off.
flyteorg/flyteacoustic-carpenter-78188
04/23/2026, 8:25 PM