How to optimize npm run build?

  build, docker, npm

My docker image takes a significant time to build, 130 seconds to be exact. I’d like to cut this down to at least 60 seconds, if at all possible.

While I found plenty of resources that improve my package installation, I couldn’t find resources that instruct me on how I can improve my build time.

  • Do webpacks improve npm run build?
  • Are there any options that improve npm run build? ie npm run build
  • Are there any alternatives to npm run build that operate faster? ie yarn
  • What things (other than the obvious, less files, better computer) affect the performance of my npm run build?
  • Are there docker configurations that allow me to improve the build-time?

Source: Docker Questions