perf: build docs on the CI runner with a warm .next cache#840
Conversation
Move `npm run build` out of the Docker image onto the runner, where actions/cache persists .next/cache across runs (the in-Docker build discarded it every time). The image now just packages the prebuilt .next and serves it with `next start`; runtime and the DocSearch entrypoint injection are unchanged. Also: checkout full history (fetch-depth: 0) so per-page dates are correct, guard buildGitDateMap against shallow clones (correct-or-absent, never wrong), modernise the Docker actions (build-push-action v6, provenance: false), and add a path-filtered pull_request trigger so pipeline changes are validated before merge. Smoke-tested via isolated build + docker run: serves /, /introduction, /api, sitemap, static assets (200); DocSearch placeholder injection intact.
|
Warning Review limit reached
Next review available in: 28 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ 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 |
Why
Every deploy cold-recompiled all ~314 pages inside the Docker image, because
.next/cache(the Next incremental build cache) can't persist across in-Docker builds on ephemeral CI runners. Moving the build onto the runner letsactions/cachekeep that cache warm between runs.Fourth of the docs build/deploy speed series (Phase B). Foundation + partial win — pairs with the standalone slim-image PR (Phase C) for the full deploy-time drop.
What
build_n_push.yml: build on the runner —checkout@v4+fetch-depth: 0→setup-node+cache: npm→npm ci→actions/cachefor.next/cache→npm run build. Then package viabuild-push-action@v6(provenance: falseto keep a single-arch manifest). Modernizedmetadata-action@v5/login-action@v3. Added a path-filteredpull_requesttrigger so pipeline changes are build-validated (no push) before merge.Dockerfile: dropped the in-imagenpm run build; the image now packages the runner-built.nextand serves vianext start. Runtime + entrypoint DocSearch injection unchanged..dockerignore: ship the built.nextoutput, exclude only.next/cache; removed inline-comment ambiguity.git-dates.mjs: guardbuildGitDateMap()against shallow clones (correct-or-absent dates, never wrong). Withfetch-depth: 0the per-page "Updated" dates now populate correctly in prod (previously blank).Testing
Isolated container smoke test (built
.nextoutside Docker →docker buildwith the new Dockerfile →docker run→ probed):/,/introduction,/api,/sitemap.xml,/llms.txt→ 200; static CSS → 200npm run buildinside the imageAPP_placeholder, injected value present in static chunksNotes
prod-deployafterward.