version: "3.9" services: litellm: image: ghcr.io/berriai/litellm:v1.83.14-stable # 显式指定安全版本,勿用 latest container_name: litellm restart: unless-stopped env_file: - .env volumes: - ./litellm-config.yaml:/app/config.yaml command: ["--config", "/app/config.yaml", "--port", "4000"] # 不对外暴露端口,只让 Nginx 访问 expose: - "4000" networks: - ai-net nginx: image: nginx:1.25-alpine container_name: litellm-nginx restart: unless-stopped ports: - "80:80" # - "443:443" # 如需 HTTPS 请自行挂载证书 volumes: - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro depends_on: - litellm networks: - ai-net networks: ai-net: driver: bridge