Improved production Docker build caching#28080
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThis PR sets BUILDKIT_PROGRESS=plain in step-local env blocks for the CI docker/build-push-action steps that build the core and full images. It also updates Dockerfile.production's core stage: adds ENV NODE_ENV=production near the start, moves corepack enable earlier, narrows initial COPYs to dependency/workspace/registry files plus components, runs pnpm install (and build deps) before copying the rest of the context, separates apt cleanup from subsequent filesystem/setup steps, and relocates ARG/ENV GHOST_BUILD_VERSION to the end of the dependency/setup block. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #28080 +/- ##
=======================================
Coverage 73.80% 73.81%
=======================================
Files 1528 1528
Lines 129417 129417
Branches 15504 15506 +2
=======================================
+ Hits 95521 95527 +6
- Misses 32917 32934 +17
+ Partials 979 956 -23
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The production image copied the full app and set the per-commit build version before installing production dependencies, so ordinary source changes could invalidate the expensive pnpm install layer. Copying dependency metadata first and setting the build version later makes cache hits easier to diagnose and reuse.
6f36260 to
fb01e7c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #28080 +/- ##
=======================================
Coverage 73.81% 73.81%
=======================================
Files 1528 1528
Lines 129417 129417
Branches 15506 15506
=======================================
Hits 95527 95527
+ Misses 32934 32910 -24
- Partials 956 980 +24
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
pnpm install --prodGHOST_BUILD_VERSIONuntil after the expensive install/setup layers so per-commit build versions do not invalidate dependency installationExpected impact
The current Dockerfile copies the whole packed app and sets
GHOST_BUILD_VERSIONbefore running production dependency installation. Because PR builds setGHOST_BUILD_VERSIONto the package version plus short SHA, that per-commit value can invalidate thepnpm install --prodlayer even when production dependencies are unchanged.This should make the expensive dependency layer reusable when only app source/admin assets change. The CI logs should also show clearer
CACHED/rebuilt layer behavior for theBuild & push core imageandBuild & push full imagesteps.Follow-up ideas kept for later
Build & push core imageandBuild & push full imagetimingsdocker bake/single multi-target build if the two separate build-push-action calls still duplicate workTesting
pnpm --filter ghost archivedocker buildx build --check --target core -f Dockerfile.production ghost/core/packagedocker buildx build --check --target full -f Dockerfile.production ghost/core/packagegit diff --check