Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.24 KB

Dockerfile-README.md

File metadata and controls

55 lines (37 loc) · 1.24 KB

Dockerfile README

This document specifies how Dockerfile should be written and setup for each Elevate micro-services.

Specifications

  1. Location: Root directory of the service.
  2. File name: Dockerfile

Expected Root Directory Structure

./<service-name>/
├── .circleci
├── Dockerfile      <----
├── .dockerignore
├── .git
├── .gitignore
├── .prettierrc.json
├── README.md
└── src

Sample Dockerfile

#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" ]

Additional Resources

  1. Dockerfile Documentation: https://docs.docker.com/engine/reference/builder/
  2. Dockerize A Node.js Web App: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
  3. Build your Node image: https://docs.docker.com/language/nodejs/build-images/