version: '3.8'

services:
  mikrotik-gemini-api:
    build: .
    container_name: mikrotik-gemini-api
    ports:
      - "8000:8000"
    environment:
      - GEMINI_API_KEY=${GEMINI_API_KEY}
      - API_HOST=0.0.0.0
      - API_PORT=8000
    volumes:
      - ../mikrotik_mcp_data.json:/app/mikrotik_mcp_data.json
      - ./logs:/app/logs
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    networks:
      - mikrotik-network

  # Optional: Add data updater service
  data-updater:
    image: python:3.11-slim
    container_name: mikrotik-data-updater
    command: >
      sh -c "
      pip install requests &&
      python /app/update_data.py
      "
    volumes:
      - ./update_data.py:/app/update_data.py
      - ../mikrotik_mcp_data.json:/app/mikrotik_mcp_data.json
    environment:
      - MIKROTIK_HOST=${MIKROTIK_HOST}
      - MIKROTIK_PORT=${MIKROTIK_PORT}
      - MIKROTIK_USER=${MIKROTIK_USER}
      - MIKROTIK_PASSWORD=${MIKROTIK_PASSWORD}
    restart: "no"  # Run once manually
    networks:
      - mikrotik-network

networks:
  mikrotik-network:
    driver: bridge

volumes:
  mikrotik-data:
