version: '3.8'

services:
  telegram-bot:
    build: .
    container_name: telegram_bot
    restart: unless-stopped

    # Переменные окружения
    environment:
      - BOT_TOKEN=${BOT_TOKEN}
      - OPENWEATHER_API_KEY=${OPENWEATHER_API_KEY}
      - NEWS_API_KEY=${NEWS_API_KEY}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - ADMIN_IDS=${ADMIN_IDS}
      - DEVELOPER_CHAT_ID=${DEVELOPER_CHAT_ID}
      - ENABLE_DEVELOPER_NOTIFICATIONS=${ENABLE_DEVELOPER_NOTIFICATIONS:-true}
      - ENABLE_AI_ERROR_PROCESSING=${ENABLE_AI_ERROR_PROCESSING:-true}
      - LOG_LEVEL=${LOG_LEVEL:-INFO}
      - DATABASE_URL=${DATABASE_URL:-telegram_bot.db}

    # Маппинг портов (если нужно)
    # ports:
    #   - "8080:8080"

    # Маппинг volumes для сохранения данных
    volumes:
      - ./data:/app/data
      - ./logs:/app/logs
      - ./temp:/app/temp
      - ./backups:/app/backups

    # Health check
    healthcheck:
      test: ["CMD", "python", "-c", "print('Bot is healthy')"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

    # Логи
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

# Сеть для изоляции
networks:
  default:
    name: telegram-bot-network