version: "3.9"
services:
  app:
    build: .
    image: agora-videoapp:latest
    restart: unless-stopped
    env_file: .env
    ports:
      - "3000:3000"
    depends_on:
      - db

  db:
    image: mysql:8.0
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
      MYSQL_DATABASE: ${DB_NAME}
    volumes:
      - dbdata:/var/lib/mysql
      - ./sql/schema.sql:/docker-entrypoint-initdb.d/1-schema.sql:ro
    ports:
      - "3306:3306"

  nginx:
    image: nginx:1.27-alpine
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./ops/nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - app

volumes:
  dbdata:
