File size: 6,219 Bytes
ab64e8d
 
daa0df2
 
ab64e8d
 
 
 
 
 
 
 
 
 
 
 
daa0df2
ab64e8d
daa0df2
 
727313f
 
 
 
ab64e8d
727313f
 
 
 
 
 
 
 
daa0df2
 
 
 
 
 
 
ab64e8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d4aaf7
aea8c21
f8baeed
 
 
 
 
ab64e8d
 
 
 
 
 
 
727313f
 
 
 
 
 
 
 
 
 
 
 
ab64e8d
 
 
 
 
 
 
daa0df2
ab64e8d
 
daa0df2
 
ab64e8d
daa0df2
 
 
ab64e8d
 
e090d34
 
ab64e8d
 
 
 
 
 
 
 
 
 
 
 
 
daa0df2
 
 
727313f
daa0df2
ab64e8d
 
 
 
 
daa0df2
 
727313f
 
ab64e8d
 
 
 
727313f
 
 
daa0df2
 
e090d34
 
ab64e8d
 
daa0df2
ab64e8d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# syntax=docker/dockerfile:1

FROM python:3.10-slim

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PIP_NO_CACHE_DIR=1 \
    PORT=7860 \
    COMFYUI_PATH=/app/ComfyUI \
    OMP_NUM_THREADS=2 \
    MKL_NUM_THREADS=2 \
    OPENBLAS_NUM_THREADS=2 \
    NUMEXPR_NUM_THREADS=2 \
    TOKENIZERS_PARALLELISM=false \
    HF_XET_HIGH_PERFORMANCE=1

EXPOSE 7860

RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    git-lfs \
    curl \
    wget \
    ca-certificates \
    ffmpeg \
    libgl1 \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender1 \
    libgomp1 \
    build-essential \
    && rm -rf /var/lib/apt/lists/* \
    && git lfs install

RUN useradd --create-home --shell /bin/bash --uid 1000 user

WORKDIR /app

RUN python -m pip install --upgrade pip setuptools wheel && \
    python -m pip install \
      "torch==2.7.1" \
      "torchvision==0.22.1" \
      "torchaudio==2.7.1" \
      --index-url https://download.pytorch.org/whl/cpu

RUN git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git /app/ComfyUI && \
    cd /app/ComfyUI && \
    python -m pip install -r requirements.txt

# Keep the CPU PyTorch versions after installing ComfyUI requirements.
RUN python -m pip install --force-reinstall \
      "torch==2.7.1" \
      "torchvision==0.22.1" \
      "torchaudio==2.7.1" \
      --index-url https://download.pytorch.org/whl/cpu

# ------------------------------------------------------------------
# Seven custom nodes
# ------------------------------------------------------------------
RUN mkdir -p /app/ComfyUI/custom_nodes && \
    cd /app/ComfyUI/custom_nodes && \
    git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Manager.git comfyui-manager && \
    git clone --depth 1 https://github.com/RealRebelAI/ComfyUI-GGUF_KREA-2.git ComfyUI-GGUF_KREA-2 && \
    git clone --depth 1 https://github.com/crystian/comfyui-crystools.git comfyui-crystools && \
    git clone --depth 1 https://github.com/rgthree/rgthree-comfy.git rgthree-comfy && \
    git clone --depth 1 https://github.com/kijai/ComfyUI-KJNodes.git ComfyUI-KJNodes && \
    git clone --depth 1 https://github.com/nicolab28/ComfyUI-ClipProj.git ComfyUI-ClipProj && \
    git clone --depth 1 https://github.com/ethanfel/ComfyUI-Krea2TextEncoder.git ComfyUI-Krea2TextEncoder && \
    git clone --depth 1 https://github.com/KLL535/ComfyUI_SimpleButcher.git ComfyUI_SimpleButcher && \
    git clone --depth 1 https://github.com/lquesada/ComfyUI-Inpaint-CropAndStitch.git ComfyUI-Inpaint-CropAndStitch && \
    git clone --depth 1 https://github.com/LAOGOU-666/Comfyui-Memory_Cleanup.git Comfyui-Memory_Cleanup && \
    git clone --depth 1 https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git ComfyUI_UltimateSDUpscale &&  \
    git clone --depth 1 https://github.com/ty0x2333/ComfyUI-Dev-Utils.git ComfyUI-Dev-Utils && \
    git clone --depth 1 https://github.com/ServiceStack/comfy-asset-downloader.git comfy-asset-downloader && \
    git clone --depth 1 https://github.com/traugdor/ComfyUI-UltimateSDUpscale-GGUF.git ComfyUI-UltimateSDUpscale-GGUF && \
    git clone --depth 1 https://github.com/tori29umai0123/ComfyUI-Model_Downloader.git ComfyUI-Model_Downloader && \
    git clone --depth 1 https://github.com/ciri/comfyui-model-downloader.git comfyui-model-downloader && \
    git clone --depth 1 https://github.com/PanicTitan/ComfyUI-Gallery ComfyUI-Gallery && \
    git clone --depth 1 https://github.com/christian-byrne/audio-separation-nodes-comfyui audio-separation-nodes-comfyui && \
    git clone --depth 1 https://github.com/yolain/ComfyUI-Easy-Use ComfyUI-Easy-Use && \
    git clone --depth 1 https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite ComfyUI-VideoHelperSuite && \
    git clone --depth 1 https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside ComfyUI_RyanOnTheInside && \
    git clone --depth 1 https://github.com/sou319b/comfyui-youtube-downloader comfyui-youtube-downloader 

RUN set -eux; \
    find /app/ComfyUI/custom_nodes -maxdepth 2 -name "requirements.txt" -exec python -m pip install --no-cache-dir -r {} \;

RUN python -m pip install \
    "huggingface_hub>=0.33" \
    "hf_transfer>=0.1.9" \
    psutil \
    websocket-client \
    opencv-python-headless \
    einops \
    transformers \
    safetensors \
    color-matcher \
    scikit-image \
    numba \
    dynamicprompts \
    diffusers

# ------------------------------------------------------------------
# Runtime directories.
#
# IMPORTANT:
# ComfyUI 0.35.x creates /app/ComfyUI/user at startup.
# It must be writable by the non-root "user" account.
# ------------------------------------------------------------------
RUN mkdir -p \
    /app/ComfyUI/user \
    /app/ComfyUI/models/unet \
    /app/ComfyUI/models/diffusion_models \
    /app/ComfyUI/models/text_encoders \
    /app/ComfyUI/models/clip \
    /app/ComfyUI/models/vae \
    /app/ComfyUI/models/loras \
    /app/ComfyUI/models/upscale_models \
    /app/ComfyUI/models/checkpoints \
    /app/ComfyUI/workflows \
    /app/ComfyUI/input \
    /app/ComfyUI/output \
    /app/ComfyUI/temp \
    /data && \
    chown -R user:user \
      /app/ComfyUI/user \
      /app/ComfyUI/models \
      /app/ComfyUI/workflows \
      /app/ComfyUI/input \
      /app/ComfyUI/output \
      /app/ComfyUI/temp \
      /data

COPY --chown=user start.sh /app/start.sh
RUN chmod +x /app/start.sh && chown user:user /app/start.sh

USER user

WORKDIR /app/ComfyUI

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONPATH=/app/ComfyUI

# Build-time sanity check.
RUN python - <<'PY'
import torch
print("PyTorch:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
assert torch.__version__.startswith("2.7.1")
assert not torch.cuda.is_available()

import comfy_kitchen
print("comfy_kitchen:", comfy_kitchen.__file__)
print("int8_attention_is_available:",
      hasattr(comfy_kitchen, "int8_attention_is_available"))
PY

COPY ./workflow /app/ComfyUI/user/default/workflows/

HEALTHCHECK --interval=30s --timeout=10s --start-period=180s --retries=5 \
  CMD curl -fsS http://127.0.0.1:7860/system_stats >/dev/null || exit 1

ENTRYPOINT ["/app/start.sh"]