@@ -9,10 +9,10 @@ ENV COMFYUI_DIR="/root/comfyui"
99
1010RUN git clone https://github.com/comfyanonymous/ComfyUI.git ${COMFYUI_DIR} && \
1111 cd ${COMFYUI_DIR} && \
12- git checkout "v0.3.77 "
12+ git checkout "v0.19.4 "
1313
1414# 复制插件列表配置文件
15- COPY code/ comfyui/custom_nodes_config/custom_nodes.json /tmp/custom_nodes.json
15+ COPY comfyui/custom_nodes_config/custom_nodes.json /tmp/custom_nodes.json
1616
1717# 批量安装自定义节点插件
1818# 从 custom_nodes.json 读取插件列表,循环安装启用的插件
@@ -80,16 +80,18 @@ RUN cd ${COMFYUI_DIR}/custom_nodes && \
8080 fi
8181
8282# 拷贝自研插件(如果有)
83- COPY code/ comfyui/custom_nodes/ ${COMFYUI_DIR}/custom_nodes/
83+ COPY comfyui/custom_nodes/ ${COMFYUI_DIR}/custom_nodes/
8484
8585FROM python:3.10.16-slim AS dependencies
8686
8787WORKDIR /root
8888
89- # 安装系统依赖(git 等,PIPInstaller 可能需要 )
89+ # 安装系统依赖(git、ffmpeg:ComfyUI>=0.19 的 PyAV/av 与部分插件构建需要 )
9090RUN \
9191 apt update && \
92- apt install -y --no-install-recommends git && \
92+ apt install -y --no-install-recommends \
93+ git ffmpeg pkg-config \
94+ build-essential cmake && \
9395 rm -rf /var/lib/apt/lists/*
9496
9597# 升级pip并初始化venv虚拟环境
@@ -108,15 +110,16 @@ COPY --from=codes ${COMFYUI_DIR} ${COMFYUI_DIR}
108110RUN --mount=type=cache,target=/root/.cache/pip \
109111 cd ${COMFYUI_DIR} && \
110112 if [ -f requirements.txt ]; then \
111- /root/venv/bin/pip install -r requirements.txt --no-cache-dir; \
113+ /root/venv/bin/pip install -r requirements.txt --no-cache-dir \
114+ --extra-index-url https://download.pytorch.org/whl/cu128; \
112115 else \
113116 echo "警告: ${COMFYUI_DIR}/requirements.txt 不存在" ; \
114117 fi
115118
116119# 安装 ComfyUI 插件的依赖
117120# 使用 ManagementService.install_custom_nodes - 智能合并依赖,处理冲突(需要 agent 代码)
118121ENV AGENT_DIR="/root/agent"
119- COPY code/ agent ${AGENT_DIR}
122+ COPY agent ${AGENT_DIR}
120123
121124# 安装 agent 的依赖(供 ManagementService 运行,使用主 Python 环境)
122125RUN --mount=type=cache,target=/root/.cache/pip \
@@ -132,10 +135,9 @@ RUN --mount=type=cache,target=/root/.cache/pip \
132135
133136# 重新安装 ComfyUI 依赖以修复被插件修改的版本,并修正特定版本冲突
134137RUN --mount=type=cache,target=/root/.cache/pip \
135- # 重新安装 ComfyUI 依赖
136- /root/venv/bin/pip install -r ${COMFYUI_DIR}/requirements.txt --no-cache-dir && \
137- # 安装 transformers 依赖, transformers 5.0.0 与 comfyui0.3.77 不兼容
138- /root/venv/bin/pip install transformers==4.56.2 --no-cache-dir && \
138+ # 与官方 requirements 一致使用 cu128 索引,避免 torch 被换成 CPU 版导致后续 wheel 失败
139+ /root/venv/bin/pip install -r ${COMFYUI_DIR}/requirements.txt --no-cache-dir \
140+ --extra-index-url https://download.pytorch.org/whl/cu128 && \
139141 /root/venv/bin/pip install setproctitle dill scikit-image -i https://mirrors.bfsu.edu.cn/pypi/web/simple/ && \
140142 # /root/venv/bin/pip install flash_attn && \
141143 # 再次强制安装指定版本的 PyTorch,防止被插件依赖覆盖
@@ -161,7 +163,7 @@ RUN \
161163 git curl wget jq ffmpeg gcc g++ build-essential zstd && \
162164 rm -rf /var/lib/apt/lists/*
163165
164- COPY code/ agent ${AGENT_DIR}
166+ COPY agent ${AGENT_DIR}
165167
166168RUN python3 -m venv ${AGENT_DIR}/venv
167169
@@ -187,6 +189,9 @@ COPY --from=dependencies ${VENV_DIR} ${VENV_DIR}
187189COPY --from=codes ${COMFYUI_DIR} ${COMFYUI_DIR}
188190COPY --from=agent ${AGENT_DIR} ${AGENT_DIR}
189191
192+ # 与 aliyunfc/funart-comfyui 约定一致:agent 镜像构建时会 COPY --from=COMFYUI_IMAGE /root/built-in/custom_nodes
193+ RUN mkdir -p /root/built-in && cp -a "${COMFYUI_DIR}/custom_nodes" /root/built-in/custom_nodes
194+
190195ENV BACKEND_TYPE="comfyui"
191196
192197RUN chmod +x ${AGENT_DIR}/entrypoint.bash
0 commit comments