services:
  # ── MySQL 데이터베이스 ──
  db:
    image: mysql:8.0
    container_name: goalskill-db
    restart: unless-stopped
    env_file:
      - .env
    ports:
      - "3307:3306"
    volumes:
      - db_data:/var/lib/mysql
      - ./back/init-db:/docker-entrypoint-initdb.d

  # ── FastAPI 백엔드 ──
  api:
    build: ./back
    container_name: goalskill-api
    restart: unless-stopped
    ports:
      - "5450:5450"
    env_file:
      - ./back/.env
    command: uvicorn main:app --host 0.0.0.0 --port 5450 --reload
    volumes:
      - ./back:/app
      - ./front/PPT:/front/PPT
      - ./front/curriculum_PDF:/front/curriculum_PDF
      - ./front/progress_PDF:/front/progress_PDF
    extra_hosts:
      - "host.docker.internal:host-gateway"
    depends_on:
      - db

  # ── Nginx 프론트엔드 ──
  web:
    build: ./front
    container_name: goalskill-web
    restart: unless-stopped
    ports:
      - "8080:80"
    volumes:
      - ./front:/usr/share/nginx/html
    depends_on:
      - api

volumes:
  db_data:
