xhs_factory/docker-compose.yml
zhoujie 087d23f3fb 📦 build(docker): 新增 Docker 容器化部署支持
- 新增 Dockerfile 用于构建 Python 应用镜像,包含多阶段构建、中文字体支持和健康检查
- 新增 docker-compose.yml 编排文件,定义主应用、MCP 服务和可选 SD WebUI 服务
- 新增 .dockerignore 文件,排除开发环境、敏感文件和构建产物
- 更新 README.md 文档,添加详细的 Docker 部署说明、服务架构和常用命令
- 更新 main.py 启动配置,支持从环境变量读取 Gradio 服务器地址和端口
- 调整 config.json 中 sd_url 的默认端口,避免与主应用端口冲突

🌐 i18n(docs): 完善中文部署文档

- 在 README.md 中新增 Docker 部署章节,提供完整的中文操作指南
- 为 docker-compose.yml 添加详细的中文服务注释
- 在 .dockerignore 中使用中文注释对忽略文件进行分类说明
2026-02-09 13:02:41 +08:00

81 lines
2.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: "3.8"
services:
# ============================================================
# 小红书 AI 爆文工坊(主应用)
# ============================================================
xhs-autobot:
build: .
container_name: xhs-autobot
restart: unless-stopped
ports:
- "7860:7860"
volumes:
# 配置文件挂载(首次请从 config.example.json 复制并填写)
- ./config.json:/app/config.json
# 工作目录(导出的文案 & 图片)
- ./xhs_workspace:/app/xhs_workspace
environment:
- GRADIO_SERVER_NAME=0.0.0.0
- GRADIO_SERVER_PORT=7860
depends_on:
xhs-mcp:
condition: service_started
networks:
- xhs-net
# ============================================================
# xiaohongshu-mcp 服务(小红书 API 代理)
# ============================================================
xhs-mcp:
image: node:20-slim
container_name: xhs-mcp
restart: unless-stopped
ports:
- "18060:18060"
working_dir: /app
# 首次启动自动安装并运行 xiaohongshu-mcp
command: >
sh -c "
npm install -g xiaohongshu-mcp &&
npx xiaohongshu-mcp --port 18060 --host 0.0.0.0
"
volumes:
# cookies 持久化(登录后保留会话)
- xhs-mcp-data:/root/.xiaohongshu-mcp
networks:
- xhs-net
# ============================================================
# Stable Diffusion WebUI可选 — 取消注释启用)
# ⚠ 需要 NVIDIA GPU + nvidia-docker
# ============================================================
# sd-webui:
# image: ghcr.io/AUTOMATIC1111/stable-diffusion-webui:latest
# container_name: sd-webui
# restart: unless-stopped
# ports:
# - "7861:7860"
# volumes:
# - sd-models:/app/models
# - sd-outputs:/app/outputs
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: all
# capabilities: [gpu]
# command: ["python", "launch.py", "--api", "--listen"]
# networks:
# - xhs-net
volumes:
xhs-mcp-data:
# sd-models:
# sd-outputs:
networks:
xhs-net:
driver: bridge