This document specifies how Dockerfile should be written and setup for each Elevate micro-services.
- Location: Root directory of the service.
- File name: Dockerfile
./<service-name>/
├── .circleci
├── Dockerfile <----
├── .dockerignore
├── .git
├── .gitignore
├── .prettierrc.json
├── README.md
└── src
#Specify the base image
FROM node:16
#Set working directory
WORKDIR /var/src/
#Copy package.json file to working directory
COPY ./src/package.json .
#Install node modules & install nodemon globally
RUN npm install && npm install -g [email protected]
#Copy contents of src folder to working directory
COPY ./src .
#Expose relevant application port
EXPOSE 3000
#Start the application
CMD [ "node", "app.js" ]
- Dockerfile Documentation: https://docs.docker.com/engine/reference/builder/
- Dockerize A Node.js Web App: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
- Build your Node image: https://docs.docker.com/language/nodejs/build-images/