diff --git a/docker-bake.hcl b/docker-bake.hcl index 64849a2..79ea180 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -67,6 +67,7 @@ target "core-cuda" { cache-to = ["type=inline"] args = { RUNTIME = "cuda" + TORCH_INDEX = "cu128" } depends_on = ["runtime-cuda"] } @@ -90,6 +91,7 @@ target "core-cpu" { cache-to = ["type=inline"] args = { RUNTIME = "cpu" + TORCH_INDEX = "cpu" } depends_on = ["runtime-cpu"] } diff --git a/services/comfy/complete/extra-requirements.txt b/services/comfy/complete/extra-requirements.txt index b2f6d20..a995efc 100644 --- a/services/comfy/complete/extra-requirements.txt +++ b/services/comfy/complete/extra-requirements.txt @@ -23,6 +23,17 @@ dill>=0.3 # ComfyUI Inspire Pack dependencies webcolors>=24.0 +# ComfyUI-Lora-Manager dependencies (node is runtime-installed onto the +# custom_nodes volume, so its imports must already exist in the venv — +# a missing module here crash-loops ComfyUI at startup) +natsort>=8.4 +olefile>=0.47 +toml>=0.10 +GitPython>=3.1 +aiosqlite>=0.20 +beautifulsoup4>=4.12 +platformdirs>=4.0 + # RMBG and AILab Segmentation timm>=1.0 groundingdino-py>=0.4.0 diff --git a/services/comfy/core/dockerfile.comfy.core b/services/comfy/core/dockerfile.comfy.core index 7a12d10..b053174 100644 --- a/services/comfy/core/dockerfile.comfy.core +++ b/services/comfy/core/dockerfile.comfy.core @@ -21,11 +21,29 @@ RUN umask 022 && \ # We clone into a temporary directory and move to /app/ComfyUI to prevent # permission issues if we were to mount /app entirely in dev modes ARG RUNTIME=cuda + +# CUDA wheel index for the torch family (torch / torchaudio / torchvision). +# Defaults to cu128 for the cuda target; the cpu target overrides this to +# "cpu" via docker-bake.hcl. Future cuda variants (cu130, etc.) can be +# added by introducing a new bake target with `args = { TORCH_INDEX = "cu130" }`. +ARG TORCH_INDEX=cu128 + RUN --mount=type=cache,target=/app/.cache/pip \ umask 022 && \ git clone https://github.com/comfyanonymous/ComfyUI.git /app/ComfyUI && \ - pip install --extra-index-url https://download.pytorch.org/whl/cu128 \ - -r /app/ComfyUI/requirements.txt && \ + # Install torch family from the wheel index ONLY (not --extra-index-url). + # --extra-index-url is additive, so pip picks the highest version across + # PyPI + the index. When PyPI ships a newer torch than the cu* index + # (which happens regularly), pip picks the PyPI build, leaving torch and + # torchaudio compiled against different CUDA versions. Using --index-url + # replaces PyPI for this command, so resolution is constrained to the + # specified index and the CUDA ABI stays consistent across all three. + pip install --index-url https://download.pytorch.org/whl/${TORCH_INDEX} \ + torch torchaudio torchvision && \ + # Install the rest of ComfyUI's requirements normally. torch, torchaudio, + # and torchvision are already installed; pip will see them satisfied and + # skip re-resolution. + pip install -r /app/ComfyUI/requirements.txt && \ pip install -r /app/ComfyUI/manager_requirements.txt # ==================================================================