improvement(docker): speed up app image build with cache mounts and parallel node-gyp#4310
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview Caps Reviewed by Cursor Bugbot for commit 60ee87d. Configure here. |
Greptile SummaryThis PR speeds up the Docker app image build by adding BuildKit cache mounts for the Next.js compiler cache ( Confidence Score: 5/5Safe to merge — changes are purely build-time optimizations with no runtime behavior impact. All three changes are sound: JOBS=4 is a well-documented fix for the isolated-vm OOM issue, per-platform cache IDs correctly isolate SWC artifacts, and removing the bun install sharp is safe since sharp 0.34.3 distributes platform binaries as optionalDependencies (no postinstall scripts required). WORKDIR context is preserved correctly after the sharp step removal. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["FROM base AS deps"] --> B["bun install --omit=dev --ignore-scripts --linker=hoisted\n(bun-cache + npm-cache mounts, no platform suffix)"]
B --> C["JOBS=4 npx node-gyp rebuild --release\n(isolated-vm native addon)"]
D["FROM base AS builder\nARG TARGETPLATFORM"] --> E["bun install -g turbo\n(bun-cache mount)"]
E --> F["COPY node_modules from deps"]
F --> G["COPY source code"]
G --> H["bun run build\n--mount next-cache-TARGETPLATFORM\n--mount turbo-cache-TARGETPLATFORM"]
C --> F
H --> I["FROM base AS runner"]
I --> J["COPY .next/standalone\n+ isolated-vm from deps\n+ static assets"]
J --> K["CMD bun apps/sim/server.js"]
Reviews (1): Last reviewed commit: "improvement(docker): speed up app image ..." | Re-trigger Greptile |
Summary
.next/cacheand.turboBuildKit cache mounts onbun run build(per-platformid=to isolate arm64/amd64 SWC artifacts)node-gyp rebuildofisolated-vmatJOBS=4(higher values OOM per isolated-vm does not build on small machines laverdet/isolated-vm#428)bun install sharpstep — sharp is already a regular dep, the second install just busts cache on every source changeType of Change
Testing
Tested manually — diff is local to docker/app.Dockerfile; will verify cold/warm ARM64 build times on first deploy after merge. Target: ~7–8 min cold, ~3–4 min warm (down from 11–12/6–7).
Checklist