Watch video: https://youtu.be/rWw0ZHwsF5Q
Docker ensure one code, run everywhere!
Make sure you have at least 16GB RAM and the docker is installed!
Dockerfile holds instruction to build an image.
//Dockerfile
FROM // Choose applicable node version
WORKDIR /app
ENV NODE_ENV development
COPY package.json yarn.lock ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "npm", "run", "dev" ]
services:
express:
build: .
depends_on:
- db
restart: unless-stopped
db:
image: mongo:latest
ports:
- 27017:27017
docker-compose build
docker-compose up -d
docker-compose restart