services: bert-all-services: build: context: . dockerfile: Dockerfile container_name: bert-all-services user: "0:0" # 显式使用 root ports: - "5002-5010:5002-5010" env_file: - .env environment: - DEVICE=${DEVICE:-cuda} - MAX_WORKERS=${MAX_WORKERS:-4} - BATCH_SIZE=${BATCH_SIZE:-32} - NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES:-all} - NVIDIA_DRIVER_CAPABILITIES=${NVIDIA_DRIVER_CAPABILITIES:-all} - MODEL_CACHE_DIR=/app/model_cache volumes: - ./logs:/app/logs - ./models:/app/models - ./model_cache:/app/model_cache restart: unless-stopped deploy: resources: limits: memory: 8G reservations: memory: 4G devices: - driver: nvidia count: all capabilities: [gpu]