services: redis: image: redis:7-alpine command: redis-server --maxmemory 1gb --maxmemory-policy allkeys-lru healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 5 nats: image: nats:2-alpine command: ["-js", "-m", "8222"] healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:8222/healthz"] interval: 5s timeout: 3s retries: 5 minio: image: minio/minio:latest command: server /data --console-address ":9001" environment: MINIO_ROOT_USER: minioadmin MINIO_ROOT_PASSWORD: minioadmin volumes: - minio_data:/data ports: - "9002:9001" healthcheck: test: ["CMD-SHELL", "curl -f http://localhost:9000/minio/health/live || exit 1"] interval: 10s timeout: 5s retries: 5 start_period: 10s api: build: . command: ["/app/api"] ports: - "8080:8080" depends_on: redis: condition: service_healthy nats: condition: service_healthy minio: condition: service_started environment: REDIS_URL: redis://redis:6379/0 NATS_URL: nats://nats:4222 MINIO_ENDPOINT: minio:9000 MINIO_ACCESS_KEY: minioadmin MINIO_SECRET_KEY: minioadmin MINIO_BUCKET: pdf-count MODEL_PATH: /app/models/model.onnx INFERENCE_CONFIG: /app/models/inference.json SYNC_MAX_FILES: 50 JOB_MAX_FILES: 50000 QUEUE_MAX_PENDING: 100000 OPENAPI_PATH: /app/openapi.yaml OCR_POOL_SIZE: 4 SYNC_PROCESS_CONCURRENCY: 4 JOB_INLINE_PROCESSING: "false" LOG_PIPELINE_TIMING: "true" volumes: - ./models/latest:/app/models:ro healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health"] interval: 10s timeout: 5s retries: 5 worker: build: . command: ["/app/worker"] depends_on: redis: condition: service_healthy nats: condition: service_healthy minio: condition: service_started environment: REDIS_URL: redis://redis:6379/0 NATS_URL: nats://nats:4222 MINIO_ENDPOINT: minio:9000 MINIO_ACCESS_KEY: minioadmin MINIO_SECRET_KEY: minioadmin MINIO_BUCKET: pdf-count MODEL_PATH: /app/models/model.onnx INFERENCE_CONFIG: /app/models/inference.json WORKER_CONCURRENCY: 4 PDF_PROCESS_TIMEOUT_SEC: 120 OCR_POOL_SIZE: 4 NATS_FETCH_MAX_WAIT_MS: 300 LOG_PIPELINE_TIMING: "true" JOB_INLINE_PROCESSING: "false" volumes: - ./models/latest:/app/models:ro autoscaler: build: context: . dockerfile: Dockerfile.autoscaler depends_on: redis: condition: service_healthy volumes: - /var/run/docker.sock:/var/run/docker.sock - .:/project:ro working_dir: /project environment: REDIS_URL: redis://redis:6379/0 COMPOSE_FILE: /project/docker-compose.yml COMPOSE_SERVICE: worker MIN_WORKERS: 1 MAX_WORKERS: 8 WORKER_SLOTS: 4 POLL_INTERVAL_SEC: 5 SCALE_DOWN_IDLE_SEC: 60 volumes: minio_data: