fix(docker): increase Node heap size to prevent OOM crash on macOS#1531
fix(docker): increase Node heap size to prevent OOM crash on macOS#1531cristiam86 merged 1 commit intomainfrom
Conversation
On macOS (especially Apple Silicon), Docker Desktop has stricter default memory limits which cause the frontend npm build to crash with: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory Set NODE_OPTIONS=--max-old-space-size=4096 in the builder stage so Node gets 4 GB of heap, which is enough to complete the Vite/Vue build. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
📝 WalkthroughWalkthroughA single environment variable is added to the Dockerfile frontend builder stage to increase Node.js memory allocation during the build process. The change specifies a 4096MB maximum heap size for Node.js via the NODE_OPTIONS environment variable, enabling larger builds without modification to the build steps themselves. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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 |
|
🎉 This PR is included in version 0.110.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Problem
On macOS (particularly Apple Silicon / M1/M2/M3),
docker compose buildfails on thefrontendservice with:This happens because Docker Desktop on macOS enforces stricter default memory limits per container, and the Vite/Vue build exhausts Node's default heap (~1.5 GB).
Fix
Added
ENV NODE_OPTIONS=--max-old-space-size=4096in thebuilderstage ofdocker/Dockerfile.frontend, giving Node 4 GB of heap to complete the build successfully.Test plan
docker compose build frontendon macOS — should complete without OOM errordocker compose up frontend🤖 Generated with Claude Code
Summary by CodeRabbit