Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ target "core-cuda" {
cache-to = ["type=inline"]
args = {
RUNTIME = "cuda"
TORCH_INDEX = "cu128"
}
depends_on = ["runtime-cuda"]
}
Expand All @@ -90,6 +91,7 @@ target "core-cpu" {
cache-to = ["type=inline"]
args = {
RUNTIME = "cpu"
TORCH_INDEX = "cpu"
}
depends_on = ["runtime-cpu"]
}
Expand Down
22 changes: 20 additions & 2 deletions services/comfy/core/dockerfile.comfy.core
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ==================================================================
Expand Down
Loading