When I try to build an angular7 project inside docker it takes around 40 minutes. The line that takes 40 minutes is
ng build --prod
92% chunk asset optimization TerserPlugin
I've ran ng build --prod outside docker on the same laptop it takes 2 minutes.
I've tried adding --build-optimizer false
and --sourceMap=false
Does not make any difference
Here is my Dockerfile
FROM node:carbon
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm install
RUN npm install -g @angular/[email protected]
COPY . .
RUN ng build --prod
EXPOSE 4200
CMD [ "npm", "start" ]
HEALTHCHECK --interval=5s --timeout=30s --retries=20 CMD curl --fail http://localhost:4200 || exit 1
docker logs [container name]
would be useful. Hopefully, it will support what @Daniel suspects to be the root cause (docker ps -a
to help get the container name) – Grandioso