# 🐳 Docker Compose - Liberi Kids Sistema de Estoque

version: '3.8'

services:
  # Aplicação principal
  liberi-kids:
    build: .
    container_name: liberi-kids-app
    ports:
      - "5000:5000"
    environment:
      - NODE_ENV=production
      - PORT=5000
      - SUPABASE_URL=${SUPABASE_URL}
      - SUPABASE_ANON_KEY=${SUPABASE_ANON_KEY}
    env_file:
      - .env
    restart: unless-stopped
    volumes:
      # Volume para uploads (se necessário)
      - ./uploads:/app/uploads
    networks:
      - liberi-network
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5000/api/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

  # Nginx como proxy reverso (opcional)
  nginx:
    image: nginx:alpine
    container_name: liberi-kids-nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      - ./ssl:/etc/nginx/ssl:ro
    depends_on:
      - liberi-kids
    networks:
      - liberi-network
    restart: unless-stopped
    profiles:
      - with-nginx

networks:
  liberi-network:
    driver: bridge

volumes:
  uploads:
    driver: local
