chore: 优化 ComfyUI Docker 配置

- .dockerignore: 精简忽略规则
- config.toml: 添加 [comfyui] 配置段
- Dockerfile: 本地源码构建、清华镜像加速
This commit is contained in:
boos
2026-05-19 02:33:23 +08:00
parent ba07517974
commit c9e98df3f1
3 changed files with 26 additions and 12 deletions
+4 -9
View File
@@ -1,9 +1,4 @@
node_modules comfy_source/venv
dist comfy_source/.git
data comfy_source/__pycache__
.git **/__pycache__
.env
*.md
docs
.github
*.log
+9
View File
@@ -20,3 +20,12 @@ upstream_timeout_secs = 300
first_byte_timeout_secs = 60 first_byte_timeout_secs = 60
max_retries = 3 max_retries = 3
proxy_log_retention_days = 30 proxy_log_retention_days = 30
[comfyui]
enabled = true
python_bin = "python3"
port = 8188
extra_args = []
max_restarts = 5
base_url = "http://127.0.0.1:8188"
agent_model = "gpt-5.5"
+13 -3
View File
@@ -2,22 +2,32 @@ FROM python:3.11-slim
WORKDIR /workspace WORKDIR /workspace
# Use USTC mirror for faster apt
RUN sed -i 's|deb.debian.org|mirrors.ustc.edu.cn|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
sed -i 's|deb.debian.org|mirrors.ustc.edu.cn|g' /etc/apt/sources.list
# Install system deps # Install system deps
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
git curl \ git curl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Clone ComfyUI # Copy ComfyUI from local source (avoid slow GitHub clone)
RUN git clone https://github.com/comfyanonymous/ComfyUI.git /workspace/ComfyUI COPY comfy_source /workspace/ComfyUI
WORKDIR /workspace/ComfyUI WORKDIR /workspace/ComfyUI
# Install git (needed for some ComfyUI custom node managers)
RUN git init
# Python venv + deps (CPU-only, generation goes through BoosAPI) # Python venv + deps (CPU-only, generation goes through BoosAPI)
RUN python3 -m venv venv && \ RUN python3 -m venv venv && \
. venv/bin/activate && \ . venv/bin/activate && \
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
pip install --upgrade pip && \ pip install --upgrade pip && \
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu && \ pip config set global.extra-index-url https://download.pytorch.org/whl/cpu && \
pip install torch torchvision torchaudio && \
grep -v kornia_rs requirements.txt | pip install -r /dev/stdin && \ grep -v kornia_rs requirements.txt | pip install -r /dev/stdin && \
pip install six && \
rm -rf ~/.cache/pip rm -rf ~/.cache/pip
ENV PATH="/workspace/ComfyUI/venv/bin:${PATH}" ENV PATH="/workspace/ComfyUI/venv/bin:${PATH}"