Skip to content

perf(ci): install dependencies once in a shared orbit-deps base image - #72

Merged
pulkitxm merged 4 commits into
mainfrom
perf/ci-build-speed
Jul 24, 2026
Merged

perf(ci): install dependencies once in a shared orbit-deps base image#72
pulkitxm merged 4 commits into
mainfrom
perf/ci-build-speed

Conversation

@pulkitxm

@pulkitxm pulkitxm commented Jul 24, 2026

Copy link
Copy Markdown
Member

Install workspace dependencies once in a shared orbit-deps base image so the four service images stop reinstalling in parallel and instead share one node_modules layer.

Prerequisite done: created the orbit-deps ECR repo (scanOnPush, AES256, MUTABLE), mirroring the others.

Evidence (local, arm64):

Layer sharing (deps -> migrate):
  deps layers=19  migrate layers=23  shared bottom layers=19
  node_modules layer shared: YES        # migrate push = only its 4 small deltas

migrate runs as non-root, resolves drizzle-kit from root-owned modules:
  uid=100(orbit) gid=101(orbit)
  drizzle-kit: v0.31.10   drizzle-orm: v0.45.2

Runtime artifacts intact:
  web       -> apps/web/server.js   doppler v3.76.1  user orbit
  realtime  -> dist/index.js        doppler v3.76.1  user orbit
  mcp       -> dist/index.js        doppler v3.76.1  user orbit

Local build (14 cores): deps 42s cold; then web 23s, realtime 9s, mcp 3s, migrate 7s
  (install runs once in deps, not four times in parallel)

pulkitxm added 2 commits July 24, 2026 19:06
The four service Dockerfiles each ran an identical bun install. Because web,
realtime and mcp are multi-stage and ship only their bundle, that install layer
is absent from the final image, so --cache-from cannot restore it and every
fresh build host reinstalled three times over, in parallel, contending for the
same cores.

Build the install once in Dockerfile.deps and have every service image derive
from it. migrate now shares that node_modules layer instead of duplicating it
through a recursive chown, so its unique layers shrink to the copied source and
it runs as the orbit user reading the root-owned modules.
…st it

The build phase now builds Dockerfile.deps first and tags it locally, then the
four service builds reference it through the DEPS_IMAGE build arg, so the shared
node_modules is resolved from the local daemon with no reinstall. post_build
pushes orbit-deps before the services, so their shared layer already exists in
ECR and each service push uploads only its own small layers. pre_build also
warms the orbit-deps cache image, which is what makes the install a cache hit
across fresh on-demand hosts.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulkitxm has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 59 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c96cfbd6-1a83-4186-b1ff-d5812e11c7a2

📥 Commits

Reviewing files that changed from the base of the PR and between ceb0f05 and cddec05.

📒 Files selected for processing (8)
  • .github/workflows/ci.yml
  • Dockerfile.deps
  • apps/mcp/Dockerfile
  • apps/realtime/Dockerfile
  • apps/web/Dockerfile
  • buildspec.yml
  • k8s/README.md
  • packages/db/Dockerfile
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/ci-build-speed

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

The container-images job built the service Dockerfiles directly, so after they
switched to FROM ${DEPS_IMAGE} it tried to pull orbit-deps:build from Docker Hub
and failed. Build the deps image first and pass it through, matching buildspec.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulkitxm has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulkitxm has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@pulkitxm
pulkitxm merged commit 0071756 into main Jul 24, 2026
5 checks passed
@pulkitxm
pulkitxm deleted the perf/ci-build-speed branch July 24, 2026 13:50
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.

1 participant