version: '3.8'

services:
  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: paintplus-backend-dev
    ports:
      - "8000:8000"
    volumes:
      - ./data:/app/data
      - ./backend:/app
    environment:
      - DATABASE_URL=sqlite:///./data/ai_photo_edit.db
      - SECRET_KEY=dev-secret-key-change-in-production
      - AI_PROVIDER=${AI_PROVIDER:-mock}
      - OPENAI_API_KEY=${OPENAI_API_KEY:-}
      - STABILITY_API_KEY=${STABILITY_API_KEY:-}
      - CORS_ORIGINS=http://localhost:5173,http://localhost:3000,http://localhost
    command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
    restart: unless-stopped
    networks:
      - paintplus-network

  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile.dev
    container_name: paintplus-frontend-dev
    ports:
      - "5173:5173"
    volumes:
      - ./frontend:/app
      - /app/node_modules
    environment:
      - VITE_API_BASE_URL=http://localhost:8000
    depends_on:
      - backend
    restart: unless-stopped
    networks:
      - paintplus-network

networks:
  paintplus-network:
    driver: bridge
