Skip to content

perf: build docs on the CI runner with a warm .next cache#840

Merged
SunsetDrifter merged 1 commit into
mainfrom
docs/build-on-runner
Jul 9, 2026
Merged

perf: build docs on the CI runner with a warm .next cache#840
SunsetDrifter merged 1 commit into
mainfrom
docs/build-on-runner

Conversation

@SunsetDrifter

@SunsetDrifter SunsetDrifter commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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 lets actions/cache keep 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: 0setup-node + cache: npmnpm ciactions/cache for .next/cachenpm run build. Then package via build-push-action@v6 (provenance: false to keep a single-arch manifest). Modernized metadata-action@v5 / login-action@v3. Added a path-filtered pull_request trigger so pipeline changes are build-validated (no push) before merge.
  • Dockerfile: dropped the in-image npm run build; the image now packages the runner-built .next and serves via next start. Runtime + entrypoint DocSearch injection unchanged.
  • .dockerignore: ship the built .next output, exclude only .next/cache; removed inline-comment ambiguity.
  • git-dates.mjs: guard buildGitDateMap() against shallow clones (correct-or-absent dates, never wrong). With fetch-depth: 0 the per-page "Updated" dates now populate correctly in prod (previously blank).

Testing

Isolated container smoke test (built .next outside Docker → docker build with the new Dockerfile → docker run → probed):

  • /, /introduction, /api, /sitemap.xml, /llms.txt200; static CSS → 200
  • Container boots (Next.js 16.1.6, ready 354ms); no npm run build inside the image
  • DocSearch env-injection intact: no leftover APP_ placeholder, injected value present in static chunks

Notes

  • Image is still ~590 MB (push/pull unchanged) — the standalone slim image is the follow-up PR.
  • Merging runs the new pipeline + pushes an image; it does not deploy. Verify with a manual prod-deploy afterward.

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.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@SunsetDrifter, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 095d27cf-e055-4d78-b697-c613d7eb4e7a

📥 Commits

Reviewing files that changed from the base of the PR and between 51afd0c and ab60067.

📒 Files selected for processing (4)
  • .dockerignore
  • .github/workflows/build_n_push.yml
  • docker/Dockerfile
  • scripts/git-dates.mjs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/build-on-runner

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SunsetDrifter
SunsetDrifter merged commit 76845ec into main Jul 9, 2026
4 checks passed
@SunsetDrifter
SunsetDrifter deleted the docs/build-on-runner branch July 9, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants