version: '3.8'

services:
  visa-sentinel:
    build: .
    image: coordinator:latest
    container_name: coordinator-sentinel
    command: ["python3", "main_sentinel.py", "--config", "config/config.json"]
    restart: unless-stopped
    shm_size: '2gb'
    volumes:
      - ./config:/app/config
      - ./logs:/app/logs
      - ./data:/app/data
      - ./plugins:/app/plugins
    environment:
      - TZ=Asia/Shanghai
      - DISPLAY=:99
      - CHROME_BIN=/opt/ungoogled-chromium/chrome
      - MIHOMO_BIN=/bin/mihomo
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 6G

  visa-booker:
    build: .
    image: coordinator:latest
    container_name: coordinator-booker
    command: ["python3", "main_booker.py", "--config", "config/config.json"]
    restart: unless-stopped
    shm_size: '2gb'
    volumes:
      - ./config:/app/config
      - ./logs:/app/logs
      - ./data:/app/data
      - ./plugins:/app/plugins
    environment:
      - TZ=Asia/Shanghai
      - DISPLAY=:99
      - CHROME_BIN=/opt/ungoogled-chromium/chrome
      - MIHOMO_BIN=/bin/mihomo
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 4G

  visa-sweeper:
    build: .
    image: coordinator:latest
    container_name: coordinator-sweeper
    command: ["python3", "main_sweeper.py"]
    restart: unless-stopped
    volumes:
      - ./config:/app/config
      - ./data:/app/data
      - ./logs:/app/logs
    environment:
      - TZ=Asia/Shanghai
    deploy:
      resources:
        limits:
          cpus: '0.2'
          memory: 256M

  registration-bot:
    build: .
    image: coordinator:latest
    container_name: tls-bot-worker
    environment:
      - CAPSOLVER_KEY=CAP-5441DD341DD3CC2FAEF0BE6FE493EE9A
    command: ["python3", "-u" ,"tls_registration_bot.py", "-n", "1", "-m", "50", "-p", "isp_all", "-u", "https://visas-fr.tlscontact.com/en-us/country/gb/vac/gbLON2fr"]
    volumes:
      - ./config:/app/config
      - ./data:/app/data
    deploy:
      resources:
        limits:
          memory: 2G