"npm install" taking forever when building docker image

I am building an image for a frontend application.
The base image is node:12.2.0
The instruction, RUN npm run build takes forever (40 min)


Is there any way to improve this?

Is your build server slow or the network connection?

For security reasons I would not use node 12:

The 12.x release line now moves into “Active LTS” and will remain so until October 2020. After that time, it will move into “Maintenance” until end of life in April 2022