Comment by iquestionshard

6 years ago

Is there a benefit to why you'd `npm install` in docker? I would likely have already done that in the checkout and test part of my workflow, and can just copy everything over from that?

> I would likely have already done that in the checkout and test part of my workflow, and can just copy everything over from that?

No you cannot, at least not for stuff that ships nodejs extensions to be compiled (e.g. by node-gyp). So for example if you're working on OS X and then run stuff in the Docker container you may hit errors. Additionally, if you are running e.g. on Ubuntu 18.04 and compile there and then run npm in a docker container on Ubuntu 16.04, you may hit library mismatches.

That is done to have a complete and repeatable build. If that is run on a different machine will still work the same.