Docker File
when you build what happen :- look we download node image from docker hub then we cache the result created one layer in container
So, why there is two copy one is package.json and other one full code ????
so when we change anything in code it will not effect previous 4 layers only reRun layer of 5 which is code. But if you change layer 3 (pkg.json) then it run all layer after .
FROM node: version of node
WORKDIR /app # It set working directory in or within the container
COPY package.json . # [We have to copy package manager file like package.json] [where you past this in container]
# build time && clean cache to keep it clean and small
RUN npm install && npm cache clean
ENV # to set global enviroment variable inside image
COPY . ./
EXPOSE 3000
# to run: node index
CMD [”node”, “index.js”]