version: '3.8'

services:
  app:
    image: ai-watch-platform
    build:
      context: .
      network: host
    container_name: ai_watch_app
    restart: always
    ports:
      - "8000:8000"
    environment:
      - MYSQL_SERVER=db
      - MYSQL_PORT=3306
      - MYSQL_USER=root
      - MYSQL_PASSWORD=root_password
      - MYSQL_DB=ai_watch
      - TZ=Asia/Shanghai
    volumes:
      # Reports volume
      - ./reports:/app/reports
      # Snapshots volume (nested inside the app structure)
      - ./snapshots:/app/backend/app/static/snapshots
    depends_on:
      - db

  db:
    image: mysql:8.0
    container_name: ai_watch_db
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=root_password
      - MYSQL_DATABASE=ai_watch
      - TZ=Asia/Shanghai
    volumes:
      # Database data volume
      - ./mysql_data:/var/lib/mysql
    ports:
      - "3307:3306"
    command: --default-authentication-plugin=mysql_native_password
