services:
  postgres:
    image: postgres:16-alpine
    environment:
      POSTGRES_DB: autoshorts
      POSTGRES_USER: autoshorts
      POSTGRES_PASSWORD: autoshorts
    ports: ["5432:5432"]
    volumes: ["postgres_data:/var/lib/postgresql/data"]
  redis:
    image: redis:7-alpine
    ports: ["6379:6379"]
  backend:
    build: ./backend
    env_file: .env
    environment:
      AUTOSHORTS_DATABASE_URL: postgresql+psycopg://autoshorts:autoshorts@postgres:5432/autoshorts
      AUTOSHORTS_STORAGE_ROOT: /app/storage
    ports: ["8000:8000"]
    volumes:
      - ./storage:/app/storage
    depends_on: [postgres, redis]
  frontend:
    build: ./frontend
    environment:
      VITE_API_BASE_URL: http://localhost:8000
    ports: ["3000:80"]
    depends_on: [backend]
volumes:
  postgres_data:
