version: "3.9" services: bgremover: build: . container_name: bgremover_pro ports: - "7860:7860" environment: - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} - U2NET_HOME=/app/models/u2net - HF_HOME=/app/models/hf - TRANSFORMERS_CACHE=/app/models/transformers - OMP_NUM_THREADS=2 - OPENBLAS_NUM_THREADS=2 volumes: # Persist downloaded models so they survive rebuilds - model_cache:/app/models restart: unless-stopped mem_limit: 14g # leave 2GB for OS on 16GB host cpus: "1.8" # leave 0.2 for OS on 2vCPU healthcheck: test: ["CMD", "curl", "-f", "http://localhost:7860/health"] interval: 30s timeout: 10s retries: 3 start_period: 120s # allow time for model loading at startup volumes: model_cache: