services: bert-all-services: build: context: . dockerfile: Dockerfile container_name: bert-all-services 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 # 传递代理环境变量(如果构建时使用了代理) - HTTP_PROXY=${HTTP_PROXY:-} - HTTPS_PROXY=${HTTPS_PROXY:-} - http_proxy=${http_proxy:-} - https_proxy=${https_proxy:-} - NO_PROXY=${NO_PROXY:-} - no_proxy=${no_proxy:-} 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]