FROM rocm/pytorch:rocm7.1_ubuntu24.04_py3.12_pytorch_release_2.6.0 # ─── ROCm environment for gfx1151 (Strix Halo) ─────────────────────────── ENV HSA_OVERRIDE_GFX_VERSION=11.5.1 ENV HSA_ENABLE_SDMA=0 ENV ROCBLAS_USE_HIPBLASLT=1 ENV PYTORCH_HIP_ALLOC_CONF=expandable_segments:False ENV HIP_LAUNCH_BLOCKING=1 # ─── Clone ComfyUI ──────────────────────────────────────────────────────── ARG COMFYUI_COMMIT=master ENV COMFYUI_PATH=/workspace/ComfyUI RUN git clone https://github.com/comfyanonymous/ComfyUI "$COMFYUI_PATH" \ && cd "$COMFYUI_PATH" \ && if [ "$COMFYUI_COMMIT" != "master" ]; then git checkout "$COMFYUI_COMMIT"; fi # ─── Pin PyTorch to ROCm 6.2.4 wheels FIRST ────────────────────────────── # Must be a separate step — mixing --index-url with -r requirements.txt # breaks PyPI resolution for all the non-torch packages. # RUN pip install --no-cache-dir --force-reinstall \ # torch torchvision torchaudio \ # --index-url https://download.pytorch.org/whl/rocm6.2.4 RUN pip install --no-cache-dir --pre torch torchvision torchaudio \ --index-url https://download.pytorch.org/whl/nightly/rocm6.3 # ─── Install ComfyUI requirements from PyPI (no index-url override) ─────── RUN pip install --no-cache-dir -r "$COMFYUI_PATH/requirements.txt" # ─── Custom nodes ───────────────────────────────────────────────────────── # ComfyUI-Manager RUN git clone https://github.com/ltdrdata/ComfyUI-Manager \ "$COMFYUI_PATH/custom_nodes/ComfyUI-Manager" \ && pip install --no-cache-dir \ -r "$COMFYUI_PATH/custom_nodes/ComfyUI-Manager/requirements.txt" # WAN 2.1 video nodes RUN git clone https://github.com/kijai/ComfyUI-WanVideoWrapper \ "$COMFYUI_PATH/custom_nodes/ComfyUI-WanVideoWrapper" \ && pip install --no-cache-dir \ -r "$COMFYUI_PATH/custom_nodes/ComfyUI-WanVideoWrapper/requirements.txt" \ || true # Video Helper Suite RUN git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite \ "$COMFYUI_PATH/custom_nodes/ComfyUI-VideoHelperSuite" \ && pip install --no-cache-dir \ -r "$COMFYUI_PATH/custom_nodes/ComfyUI-VideoHelperSuite/requirements.txt" \ || true # ─── Model directories ──────────────────────────────────────────────────── RUN mkdir -p \ "$COMFYUI_PATH/models/checkpoints" \ "$COMFYUI_PATH/models/vae" \ "$COMFYUI_PATH/models/loras" \ "$COMFYUI_PATH/models/unet" \ "$COMFYUI_PATH/models/clip" \ "$COMFYUI_PATH/models/controlnet" \ "$COMFYUI_PATH/output" # NOTE: sageattention removed — CUDA-only, won't build on ROCm. # --use-pytorch-cross-attention below is the ROCm-compatible equivalent. WORKDIR "$COMFYUI_PATH" EXPOSE 8188 CMD ["python", "main.py", \ "--listen", "0.0.0.0", \ "--port", "8188", \ "--use-pytorch-cross-attention", \ "--cpu-vae"]