Final Docker Compose file

Here is the final Docker Compose configuration file (YAML) used to get up and running the multi containers application.

docker-compose.yaml
version: "3.8"
services:
  mongodb:
    image: "mongo"
    container_name: mongo
    volumes:
      - mongo-volume:/data/db
    env_file:
      - ./env/mongodb.env
  backend:
    build: ./backend
    container_name: backend
    ports:
      - '80:80'
    volumes:
      - logs:/app/logs
      - ./backend:/app
      - /app/node_modules
    env_file:
      - ./env/backend.env
    depends_on:
      - mongodb
  frontend:
    build: ./frontend
    container_name: frontend
    ports:
      - '3333:3000'
    volumes:
      - ./frontend/src:/app/src #bind mount
    stdin_open: true
    tty: true
    depends_on:
      - backend
volumes:
  mongo-volume:
  logs:

Last updated