Here is my Dockerfile
:
FROM node:12-slim
ENV NODE_ENV=production
WORKDIR /
# COPY . . # COPY ENTIRE FOLDER ?
COPY ./package.json ./package.json
COPY ./dist ./dist
RUN npm install --only=production
EXPOSE 8080
ENTRYPOINT npm start
Here is my .dockerignore
file:
node_modules
You see that I'm just copying package.json
and not package-lock.json
. I guessed that, since I'll be running RUN npm install
to build the image, I thought that it should create its own package-lock.json
.
But I got this warning during the build:
> Step #0: > protobufjs@6.10.2 postinstall /node_modules/protobufjs
> Step #0: > node scripts/postinstall
> Step #0:
> Step #0: npm notice created a lockfile as package-lock.json. You should commit this file.
> Step #0: npm WARN knative-serving-helloworld@1.0.0 No repository field.
> Step #0:
> Step #0: added 304 packages from 217 contributors and audited 312 packages in 15.27s
So, should I add this to my Dockerfile
?
COPY ./package-lock.json ./package-lock.json