hapipal / boilerplate

A friendly, proven starting place for your next hapi plugin or deployment
https://hapipal.com
184 stars 26 forks source link

Dockerfile - should `npm ci` be used? #100

Open jameswragg opened 11 months ago

jameswragg commented 11 months ago

Referring to the following line: https://github.com/hapipal/boilerplate/blob/d1b4fda62eb8aaff10c78eea34096b3164555c6e/server/Dockerfile#L21

npm provides the npm ci command to install the versions specified in the package-lock.json. If your container is being built by CI & test are run with it, I believe you'd want the same versions as those running locally so should the command be npm ci here?

devinivy commented 11 months ago

Yes, that seems right! Will leave this issue open until that's settled.

Nargonath commented 11 months ago

As I mentioned on Discord on this previous topic, I believe it'd be a nice addition. You could also leverage multi-steps Docker image if you'd want to use npm i for dev and npm ci for prod. The problem would be that you'll be installing the dependencies two times when building for prod which might not be ideal. It's probably better to only use npm ci.

Nargonath commented 11 months ago

@jameswragg in case we move forward with this, do you wan to make the PR?