version: '3.8'

services:
  balotario:
    build: .
    container_name: balotario-app
    ports:
      - "5000:5000"
    environment:
      - FLASK_ENV=production
      - FLASK_DEBUG=false
      - DOCKER_CONTAINER=true
    volumes:
      # Montar datos para persistencia (opcional)
      - ./data:/app/data:ro
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5000/"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    networks:
      - balotario-network

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

networks:
  balotario-network:
    driver: bridge

volumes:
  balotario-data:
    driver: local
