-
Notifications
You must be signed in to change notification settings - Fork 46
Implement Docker layer caching for all workflows #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Use docker/build-push-action with GHA cache backend - Implement PR-specific cache scope with fallback to main branch - Enable mode=max to cache all Dockerfile stages - Expected improvement: 60s → 10-20s on warm builds
- Use docker/build-push-action with GHA cache backend for both beta and stable releases - Implement shared 'release' cache scope for main branch builds - Enable mode=max to cache all Dockerfile stages including multi-arch layers - Expected improvement: 7.5min → 2min on warm builds (70% reduction)
- Use docker/build-push-action with GHA cache backend - Implement preview-specific cache scope with multi-level fallback - Reuse PR cache from pullrequest.yml when available - Enable mode=max to cache all Dockerfile stages - Expected improvement: 7.5min → 2-3min on warm builds
- Add npm cache mount in builder stage for faster dependency installs - Add apt cache mounts in runtime stage for faster system package installs - Add pip cache mount in runtime stage for faster Python package installs - Removes --no-cache-dir from pip to enable caching - Additional ~20% speedup when dependencies change
🦋 Changeset detectedLatest commit: 14424a8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Claude Code ReviewOverall Assessment: LGTM - Well-implemented Docker layer caching strategy with proper cache scopes and mount configurations. Strengths
Minor IssuesLine 77-78 (Dockerfile): The apt cache configuration creates files that persist beyond the RUN layer, but since these are in cache mounts that are ephemeral, this is fine. However, consider if the Line 99 (Dockerfile): The Performance NotesExpected improvements match industry standards:
ChangesetAppropriate patch-level change. The changeset correctly notes this benefits users building from source. Verdict: Ready to merge. |
Adds npm cache mount to prod-deps stage for consistency with builder stage. This speeds up production dependency installs when layers are invalidated.
- Remove leftover instructional comment in pullrequest.yml - Centralize version extraction in release.yml unit-tests job - Reuse version output in publish jobs to eliminate duplication
Multi-arch Docker builds take 7-8 minutes on cold cache. The previous 10-minute timeout was too tight and caused failures when builds took slightly longer due to runner variance or network conditions. 15 minutes provides adequate 2x buffer while still catching genuinely stuck builds.
commit: |
🐳 Docker Image PublishedFROM cloudflare/sandbox:0.0.0-pr-176-fd7f207Version: You can use this Docker image with the preview package from this PR. |
Summary
mode=maxto cache all Dockerfile stages (pruner, builder, prod-deps, runtime)Technical Details
Cache Architecture:
releasescope: Shared cache for main branch buildspr-{number}scope: Isolated cache per PR (pullrequest.yml)preview-pr-{number}scope: Isolated cache per PR preview (pkg-pr-new.yml)Fallback Chains:
Cache Mounts:
/root/.npm/var/cache/apt+/var/lib/apt/root/.cache/pip