version: '3.8'

services:
  proxy-bot:
    build: .
    container_name: telegram-proxy-bot
    restart: unless-stopped
    volumes:
      # Mount data directory for persistent cache
      - ./data:/app/data
      # Mount channels.txt file
      - ./channels.txt:/app/channels.txt:ro
      # Mount logs directory
      - ./logs:/app/logs
    environment:
      - TZ=Asia/Tehran
      # You can override these via environment variables
      - API_ID=${API_ID:-2413260}
      - API_HASH=${API_HASH:-bf18c75d154b31b294857a28079163e3}
      - PHONE_NUMBER=${PHONE_NUMBER:-+989991219273}
      - BACKUP_CHANNEL=${BACKUP_CHANNEL:-@fastify_proxy}
      - CHANNELS_FILE=${CHANNELS_FILE:-channels.txt}
    healthcheck:
      test: ["CMD", "python3", "-c", "import os; exit(0 if os.path.exists('/app/data/proxy_cache.json') else 1)"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

volumes:
  bot_data:
    driver: local
