Skip to content

Docker + nodejs - JavaScript heap out of memory #2564

@RicardoGaefke

Description

@RicardoGaefke
  • Node.js Version: 12.15.0-r1
  • OS: Linux Alpine
  • Scope (install, code, runtime, meta, other?): npm run production
  • Module (and version) (if relevant):

I have a .NET Core & SSR React app and everything runs fine on my computer and on Azure Pipelines and Azure Win and Linux WebApps but when I try to build a Docker Image I always receive 'JavaScript heap out of memory'.

Here is my Dockerfile:

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-alpine AS build

RUN apk add --no-cache bash git openssh nodejs npm

RUN git clone -b dev https://github.com/RicardoGaefke/profile4d.git ./app

WORKDIR /app/src/Web.Identity

RUN NODE_OPTIONS=--max_old_space_size=32768‬

RUN npm install

RUN npm run lint-fix

RUN npm run production1

RUN dotnet publish -c Release ./Web.Identity.csproj -r linux-musl-x64 -o ./publish

FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.0-alpine as runtime

EXPOSE 80

WORKDIR /app

COPY --from=build /app/src/Web.Identity/publish ./

ENTRYPOINT ["dotnet", "Web.Identity.dll"]

And this is my build command:

docker build -f .\Dockerfile.web.identity.cloud -t web_identity_cloud .

Can anybody please help me?

Thank a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions