# LTX Director Image-to-Video — ComfyUI on a Hugging Face Docker Space # GPU target: L40S / A100 (48GB). LTX-2.3 needs 32GB+ VRAM and 100GB+ disk. FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive \ PIP_NO_CACHE_DIR=1 \ PYTHONUNBUFFERED=1 \ HF_HUB_ENABLE_HF_TRANSFER=1 # System dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ git wget curl ca-certificates ffmpeg \ python3.11 python3.11-venv python3.11-dev python3-pip \ build-essential \ && rm -rf /var/lib/apt/lists/* \ && ln -sf /usr/bin/python3.11 /usr/bin/python \ && ln -sf /usr/bin/python3.11 /usr/bin/python3 # HF Spaces convention: run as non-root user with UID 1000 RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR /home/user/app # Python tooling RUN python -m pip install --user --upgrade pip # PyTorch (CUDA 12.4 build) RUN pip install --user torch torchvision torchaudio \ --index-url https://download.pytorch.org/whl/cu124 # ComfyUI core RUN git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git ComfyUI WORKDIR /home/user/app/ComfyUI RUN pip install --user -r requirements.txt RUN pip install --user huggingface_hub hf_transfer # Custom nodes: LTXVideo extension + WhatDreamsCost LTX Director WORKDIR /home/user/app/ComfyUI/custom_nodes RUN git clone --depth 1 https://github.com/Lightricks/ComfyUI-LTXVideo.git \ && if [ -f ComfyUI-LTXVideo/requirements.txt ]; then \ pip install --user -r ComfyUI-LTXVideo/requirements.txt; fi RUN git clone --depth 1 https://github.com/WhatDreamsCost/WhatDreamsCost-ComfyUI.git \ && if [ -f WhatDreamsCost-ComfyUI/requirements.txt ]; then \ pip install --user -r WhatDreamsCost-ComfyUI/requirements.txt; fi # Preload the LTX Director image-to-video workflow into the user workflows dir # so it shows up in the ComfyUI "Open workflow" menu. WORKDIR /home/user/app/ComfyUI RUN mkdir -p user/default/workflows \ && cp custom_nodes/ComfyUI-LTXVideo/example_workflows/2.0/LTX-2_I2V_Distilled_wLora.json \ user/default/workflows/ltx_director_i2v.json 2>/dev/null || true # Entrypoint: download weights on boot, then launch ComfyUI on port 7860 COPY --chown=user:user start.sh /home/user/app/start.sh USER root RUN chmod +x /home/user/app/start.sh USER user EXPOSE 7860 ENTRYPOINT ["/home/user/app/start.sh"]