Usually I run my application as npm run dev and in the package.json file has script like below
"scripts": {
"dev": "nodemon server.ts",
}
here everything working fine.
I'm build docker image based on below Dockerfile
FROM node:14.17-alpine
RUN npm i -g typescript@4.2.4
RUN npm i -g nodemon
RUN apk add g++ make python
WORKDIR /app
ADD package*.json ./
RUN npm install
ADD . .
CMD npm run dev
I can able to successfully build the image using
docker build --tag test-backend .
and when I this image
docker run -it -p 3003:3003 test-backend
I'm facing javascript heap memory outage
<--- Last few GCs --->
[31:0x55effca3d8e0] 57856 ms: Mark-sweep (reduce) 989.3 (996.6) -> 988.2 (997.9) MB, 1275.1 / 0.0 ms (average mu = 0.173, current mu = 0.035) allocation failure scavenge might not succeed
[31:0x55effca3d8e0] 59100 ms: Mark-sweep (reduce) 989.3 (999.9) -> 988.5 (999.4) MB, 1206.7 / 0.0 ms (average mu = 0.107, current mu = 0.030) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Aborted
[nodemon] app crashed - waiting for file changes before starting...
what is the reason behing this cause ??