Stable build fails FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

how can it be that the stable branch fails to build when I use:
docker build . --target bolt-ai-development

Blockquote
Step 24/41 : RUN pnpm run build
—> Running in 02e56f9b06ed

bolt@0.0.7 build /app
remix vite:build

fatal: not a git repository (or any of the parent directories): .git
[warn] Data fetching is changing to a single fetch in React Router v7
┃ You can use the `v3_singleFetch` future flag to opt-in early.
┃ -> remix /docs/en/2.13.1/start/future-flags#v3_singleFetch
┗
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
vite v5.4.11 building for production...
transforming...
[plugin:vite:resolve] [plugin vite:resolve] Module "path" has been externalized for browser compatibility, imported by "/app/node_modules/.pnpm/istextorbinary@9.5.0/node_modules/istextorbinary/edition-browsers/index.js". See vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "path" has been externalized for browser compatibility, imported by "/app/node_modules/.pnpm/istextorbinary@9.5.0/node_modules/istextorbinary/edition-browsers/index.js". See vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
app/components/ui/Collapsible.tsx (1:0): Error when using sourcemap for reporting an error: Can't resolve original location of error.
app/components/ui/ScrollArea.tsx (1:0): Error when using sourcemap for reporting an error: Can't resolve original location of error.
app/components/ui/Badge.tsx (1:0): Error when using sourcemap for reporting an error: Can't resolve original location of error.
node_modules/.pnpm/istextorbinary@9.5.0/node_modules/istextorbinary/edition-browsers/index.js (18:31): "basename" is not exported by "__vite-browser-external", imported by "node_modules/.pnpm/istextorbinary@9.5.0/node_modules/istextorbinary/edition-browsers/index.js".
✓ 3132 modules transformed.
Generated an empty chunk: "api.models._provider".
Generated an empty chunk: "api.system.app-info".
Generated an empty chunk: "api.system.git-info".
Generated an empty chunk: "api.check-env-key".
Generated an empty chunk: "api.git-proxy._".
Generated an empty chunk: "api.enhancer".
Generated an empty chunk: "api.llmcall".
Generated an empty chunk: "api.deploy".
Generated an empty chunk: "api.health".
Generated an empty chunk: "api.models".
Generated an empty chunk: "api.update".
Generated an empty chunk: "api.chat".
[unocss] The labeled variant is experimental and may not follow semver.
[unocss] failed to load icon "lucide:clock"
[unocss] failed to load icon "lucide:message-square"
[unocss] failed to load icon "lucide:search"
rendering chunks...

<— Last few GCs —>


[30:0x1fadbf30]    35372 ms: Mark-Compact (reduce) 1994.6 (2082.3) -> 1994.5 (2082.3) MB, 399.94 / 0.00 ms  (average mu = 0.326, current mu = 0.001) allocation failure; scavenge might not succeed
[30:0x1fadbf30]    35774 ms: Mark-Compact (reduce) 1995.0 (2082.8) -> 1995.0 (2082.8) MB, 401.47 / 0.00 ms  (average mu = 0.193, current mu = 0.001) allocation failure; scavenge might not succeed

<— JS stacktrace —>

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xb8ced1 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
 2: 0xf06460 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 3: 0xf06747 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 4: 0x11182e5  [node]
 5: 0x1130168 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 6: 0x1106281 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 7: 0x1107415 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0x10e3b36 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
 9: 0x10d5764 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [node]
10: 0x10d7f46 v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString(int, v8::internal::AllocationType) [node]
11: 0x10eef64 v8::internal::Factory::NewStringFromUtf8(v8::base::Vector<char const> const&, v8::internal::AllocationType) [node]
12: 0xf18cf2 v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [node]
13: 0xdf17e7  [node]
14: 0xdf191f node::StringDecoder::DecodeData(v8::Isolate*, char const*, unsigned long*) [node]
15: 0xdf1e5d  [node]
16: 0xf6e88f v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [node]
17: 0xf6f0fd  [node]
18: 0xf6f5c5 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
19: 0x1979df6  [node]
Aborted (core dumped)
 ELIFECYCLE  Command failed with exit code 134.
The command '/bin/sh -c pnpm run build' returned a non-zero code: 134

type or paste code here

docker version
Client: Docker Engine - Community
Version: 20.10.14
API version: 1.41
Go version: go1.16.15
Git commit: a224086
Built: Thu Mar 24 01:47:58 2022
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.14
API version: 1.41 (minimum version 1.12)
Go version: go1.16.15
Git commit: 87a90dc
Built: Thu Mar 24 01:45:50 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.5.11
GitCommit: 3df54a852345ae127d1fa3092b95168e4a88e2f8
runc:
Version: 1.0.3
GitCommit: v1.0.3-0-gf46b6ba
docker-init:
Version: 0.19.0
GitCommit: de40ad0

ENV NODE_OPTIONS=“–max-old-space-size=14336” fixed the build but now I get the following in the browser:

Cannot find module 'react-dnd' imported from '/app/app/root.tsx'
    at nodeImport (file:///app/node_modules/.pnpm/vite@5.4.11_@types+node@22.10.1_sass-embedded@1.81.0/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53047:19)
    at ssrImport (file:///app/node_modules/.pnpm/vite@5.4.11_@types+node@22.10.1_sass-embedded@1.81.0/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52914:22)
    at eval (/app/app/root.tsx:14:38)
    at instantiateModule (file:///app/node_modules/.pnpm/vite@5.4.11_@types+node@22.10.1_sass-embedded@1.81.0/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5

is this a it works on my machine issue? I never had this with docker before? Normally it works or it doesn’t, that’s the whole idea of docker no?

@j-jeurissen I had this too on my install on VPS (https://www.youtube.com/watch?v=dy_0nrPf6J0)

I am not sure if this is then an issue we need to fix @thecodacus @xKevIsDev ?

thanks so much! I will take a look at it soon!