version: "3.8"

services:
  worker:
    build:
      context: ..
      dockerfile: docker/Dockerfile.worker
    environment:
      - IQ_HOST__URL=http://host:3000
      - IQ_WORKER__THREADS=4
      - IQ_WORKER__AUTOSCALE=false
      - IQ_LOGGING__LEVEL=INFO
    volumes:
      - ../config:/app/config:ro
    restart: unless-stopped
    deploy:
      replicas: 1
      resources:
        limits:
          cpus: "2"
          memory: 2G
        reservations:
          cpus: "0.5"
          memory: 512M

  # Multi-host worker configuration
  # worker-multihost:
  #   build:
  #     context: ..
  #     dockerfile: docker/Dockerfile.worker
  #   environment:
  #     - IQ_HOSTS=http://host1:3000,http://host2:3000
  #     - IQ_WORKER__THREADS=8

  # Autoscaling worker
  # worker-autoscale:
  #   build:
  #     context: ..
  #     dockerfile: docker/Dockerfile.worker
  #   environment:
  #     - IQ_HOST__URL=http://host:3000
  #     - IQ_WORKER__AUTOSCALE=true
  #     - IQ_WORKER__MIN_THREADS=2
  #     - IQ_WORKER__MAX_THREADS=16
