https://levelup.gitconnected.com/use-docker-with-nodejs-projects-like-a-pro-a9e7504e1308
FROM node:lts-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm ci --only=production
COPY . .
EXPOSE 3000
RUN npm run build
CMD [ "node", "dist/index.js" ]
If you want to build the code for production, we can use the following command. The explanation about the command npm ci can be found here.
0 commenti