From b31b6d57859cbcac768b4eb71d12c93f2d227dbe Mon Sep 17 00:00:00 2001 From: Rune Philosof <57357936+runephilosof-abtion@users.noreply.github.com> Date: Thu, 4 Jul 2024 12:56:10 +0200 Subject: [PATCH] Limit max-old-space-size to avoid allocation failure I had to limit the max-old-space-size to build. I was getting this error. ``` FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ``` It can probably make do with a lower value, I did not try. --- Dockerfile | 2 ++ frontend/Dockerfile | 3 +++ widget/Dockerfile | 3 +++ 3 files changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index 6633d9c7..5fb05827 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,8 @@ COPY --chown=node:node . . # Set NODE_ENV environment variable ENV NODE_ENV production +# If you get `Allocation failed`, lower this https://nodejs.org/api/cli.html#cli_max_old_space_size_size_in_megabytes +ENV NODE_OPTIONS --max-old-space-size=8192 # Run the build command which creates the production bundle RUN yarn run build diff --git a/frontend/Dockerfile b/frontend/Dockerfile index dd1f53ec..193bb987 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -16,6 +16,9 @@ RUN npm install COPY . . COPY .env.docker .env +# If you get `Allocation failed`, lower this https://nodejs.org/api/cli.html#cli_max_old_space_size_size_in_megabytes +ENV NODE_OPTIONS --max-old-space-size=8192 + # Building our application RUN npm run build diff --git a/widget/Dockerfile b/widget/Dockerfile index 0ef17ca0..9aeba72e 100644 --- a/widget/Dockerfile +++ b/widget/Dockerfile @@ -15,6 +15,9 @@ RUN npm install # Copying all the files in our project COPY . . +# If you get `Allocation failed`, lower this https://nodejs.org/api/cli.html#cli_max_old_space_size_size_in_megabytes +ENV NODE_OPTIONS --max-old-space-size=8192 + # Building our application RUN npm run build