# PCB AFM Simulation System - Docker Compose
version: "3.8"

services:
  backend:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: afm-backend
    ports:
      - "8000:8000"
    volumes:
      - ./output:/app/output
      - ./models:/app/models:ro
      - ./web/backend/.env:/app/.env:ro
    environment:
      - DATABASE_URL=sqlite:///./afm_sim.db
      - MAX_PARALLEL_TASKS=2
      - KIMI_API_KEY=${KIMI_API_KEY:-}
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"]
      interval: 30s
      timeout: 10s
      retries: 3

  frontend:
    image: nginx:alpine
    container_name: afm-frontend
    ports:
      - "5173:80"
    volumes:
      - ./web/frontend/dist:/usr/share/nginx/html:ro
      - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - backend
    restart: unless-stopped

volumes:
  output:
