services:
  postgres:
    image: postgres:16-alpine
    container_name: hy_qa_postgres
    environment:
      POSTGRES_DB: hyqa
      POSTGRES_USER: hyqa
      POSTGRES_PASSWORD: hyqa
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U hyqa -d hyqa"]
      interval: 5s
      timeout: 5s
      retries: 10

  backend:
    build:
      context: ./backend
    container_name: hy_qa_backend
    environment:
      DATABASE_URL: postgresql+psycopg://hyqa:hyqa@postgres:5432/hyqa
      MODEL_NAME: gpt-4.1-mini
      SCHEDULE_CRON: "0 1 * * *"
      SCHEDULE_TIMEZONE: Asia/Shanghai
      MOCK_MODE: "true"
    ports:
      - "8000:8000"
    depends_on:
      postgres:
        condition: service_healthy

  frontend:
    build:
      context: ./frontend
    container_name: hy_qa_frontend
    environment:
      NEXT_PUBLIC_API_BASE_URL: http://localhost:8000/api
    ports:
      - "3000:3000"
    depends_on:
      - backend

volumes:
  postgres_data:

