I have learnt this for a while, but just to recap.
Run npm ci or yarn --frozen-lockfile inside Dockerfile, but before that, don't forget to copy lock-file.
npm ci
yarn --frozen-lockfile
Dockerfile
COPY package.json yarn.lock ./ RUN yarn --production --frozen-lockfile
And, I also noticed that Yarn is already installed by default in the Docker image, no need to apk add yarn.
apk add yarn
Awesome!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I have learnt this for a while, but just to recap.
Run
npm ci
oryarn --frozen-lockfile
insideDockerfile
, but before that, don't forget to copy lock-file.And, I also noticed that Yarn is already installed by default in the Docker image, no need to
apk add yarn
.Awesome!