Skip to content

fix(docker): increase Node heap size to prevent OOM crash on macOS#1531

Merged
cristiam86 merged 1 commit intomainfrom
fix/frontend-docker-heap-oom
Mar 13, 2026
Merged

fix(docker): increase Node heap size to prevent OOM crash on macOS#1531
cristiam86 merged 1 commit intomainfrom
fix/frontend-docker-heap-oom

Conversation

@danieljrc888
Copy link
Contributor

@danieljrc888 danieljrc888 commented Mar 13, 2026

Problem

On macOS (particularly Apple Silicon / M1/M2/M3), docker compose build fails on the frontend service with:

FATAL ERROR: Ineffective mark-compacts near heap limit
Allocation failed - JavaScript heap out of memory
ERROR: "build-only" exited with 134.

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=4096 in the builder stage of docker/Dockerfile.frontend, giving Node 4 GB of heap to complete the build successfully.

Test plan

  • Run docker compose build frontend on macOS — should complete without OOM error
  • Verify the built image starts correctly with docker compose up frontend
  • Confirm no regression on Linux builds (CI)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved build stability by increasing memory allocation during the build process.

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]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

A 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

Cohort / File(s) Summary
Docker Build Configuration
docker/Dockerfile.frontend
Adds ENV NODE_OPTIONS=--max-old-space-size=4096 to the builder stage to increase Node.js heap memory limit during build compilation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A memory boost, oh what a delight,
Four gigs of space, Node builds just right!
The builder stage now runs so free,
No more crashes—just harmony! 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and specifically summarizes the main change: adding NODE_OPTIONS to increase heap size for preventing OOM crashes on macOS. It directly reflects the primary fix in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description is comprehensive and well-structured, addressing the problem, fix, and testing approach clearly.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/frontend-docker-heap-oom
📝 Coding Plan
  • Generate coding plan for human review comments

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 and usage tips.

@danieljrc888 danieljrc888 requested a review from cristiam86 March 13, 2026 08:52
@cristiam86 cristiam86 merged commit 1107b4d into main Mar 13, 2026
23 of 24 checks passed
@github-actions
Copy link
Contributor

🎉 This PR is included in version 0.110.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants