Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +99 -66
Dockerfile
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
ENV MKL_NUM_THREADS=2
|
| 10 |
-
ENV OPENBLAS_NUM_THREADS=2
|
| 11 |
-
ENV NUMEXPR_NUM_THREADS=2
|
| 12 |
|
| 13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
git \
|
| 15 |
git-lfs \
|
| 16 |
curl \
|
| 17 |
wget \
|
|
|
|
| 18 |
ffmpeg \
|
| 19 |
libgl1 \
|
| 20 |
libglib2.0-0 \
|
|
@@ -22,7 +30,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 22 |
libxext6 \
|
| 23 |
libxrender1 \
|
| 24 |
libgomp1 \
|
| 25 |
-
ca-certificates \
|
| 26 |
build-essential \
|
| 27 |
&& rm -rf /var/lib/apt/lists/* \
|
| 28 |
&& git lfs install
|
|
@@ -31,29 +38,52 @@ RUN useradd --create-home --shell /bin/bash --uid 1000 user
|
|
| 31 |
|
| 32 |
WORKDIR /app
|
| 33 |
|
| 34 |
-
RUN pip install --
|
| 35 |
-
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
#
|
| 55 |
-
RUN
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
psutil \
|
| 58 |
websocket-client \
|
| 59 |
opencv-python-headless \
|
|
@@ -66,62 +96,65 @@ RUN pip install --no-cache-dir \
|
|
| 66 |
dynamicprompts \
|
| 67 |
diffusers
|
| 68 |
|
| 69 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
RUN mkdir -p \
|
| 71 |
-
/app/ComfyUI/
|
|
|
|
| 72 |
/app/ComfyUI/models/diffusion_models \
|
| 73 |
/app/ComfyUI/models/text_encoders \
|
|
|
|
| 74 |
/app/ComfyUI/models/vae \
|
| 75 |
/app/ComfyUI/models/loras \
|
| 76 |
/app/ComfyUI/models/upscale_models \
|
| 77 |
-
/app/ComfyUI/models/
|
|
|
|
| 78 |
/app/ComfyUI/input \
|
| 79 |
/app/ComfyUI/output \
|
| 80 |
-
/app/ComfyUI/temp
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
USER user
|
| 86 |
|
| 87 |
-
ENV HOME=/home/user
|
| 88 |
-
ENV PATH=/home/user/.local/bin:$PATH
|
| 89 |
-
ENV PYTHONPATH=/app/ComfyUI
|
| 90 |
-
|
| 91 |
WORKDIR /app/ComfyUI
|
| 92 |
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
RUN python - <<'PY'
|
| 95 |
import torch
|
| 96 |
-
import comfy_kitchen
|
| 97 |
-
|
| 98 |
-
print("=" * 60)
|
| 99 |
print("PyTorch:", torch.__version__)
|
| 100 |
print("CUDA available:", torch.cuda.is_available())
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
| 102 |
print("comfy_kitchen:", comfy_kitchen.__file__)
|
| 103 |
print("int8_attention_is_available:",
|
| 104 |
hasattr(comfy_kitchen, "int8_attention_is_available"))
|
| 105 |
-
print("=" * 60)
|
| 106 |
-
|
| 107 |
-
assert torch.__version__.startswith("2.7.1")
|
| 108 |
-
assert not torch.cuda.is_available()
|
| 109 |
-
assert hasattr(comfy_kitchen, "int8_attention_is_available")
|
| 110 |
PY
|
| 111 |
|
| 112 |
COPY ./workflow /app/ComfyUI/user/default/workflows/
|
| 113 |
|
| 114 |
-
|
|
|
|
| 115 |
|
| 116 |
-
|
| 117 |
-
--interval=30s \
|
| 118 |
-
--timeout=10s \
|
| 119 |
-
--start-period=180s \
|
| 120 |
-
--retries=5 \
|
| 121 |
-
CMD curl -f http://127.0.0.1:7860/system_stats || exit 1
|
| 122 |
-
|
| 123 |
-
CMD ["python", "-u", "main.py", \
|
| 124 |
-
"--cpu", \
|
| 125 |
-
"--listen", "0.0.0.0", \
|
| 126 |
-
"--port", "7860", \
|
| 127 |
-
"--output-directory", "/app/ComfyUI/output"]
|
|
|
|
| 1 |
+
# syntax=docker/dockerfile:1
|
| 2 |
+
|
| 3 |
FROM python:3.10-slim
|
| 4 |
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
| 6 |
+
PYTHONUNBUFFERED=1 \
|
| 7 |
+
PYTHONDONTWRITEBYTECODE=1 \
|
| 8 |
+
PIP_NO_CACHE_DIR=1 \
|
| 9 |
+
PORT=7860 \
|
| 10 |
+
COMFYUI_PATH=/app/ComfyUI \
|
| 11 |
+
OMP_NUM_THREADS=2 \
|
| 12 |
+
MKL_NUM_THREADS=2 \
|
| 13 |
+
OPENBLAS_NUM_THREADS=2 \
|
| 14 |
+
NUMEXPR_NUM_THREADS=2 \
|
| 15 |
+
TOKENIZERS_PARALLELISM=false \
|
| 16 |
+
HF_XET_HIGH_PERFORMANCE=1
|
| 17 |
|
| 18 |
+
EXPOSE 7860
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 21 |
git \
|
| 22 |
git-lfs \
|
| 23 |
curl \
|
| 24 |
wget \
|
| 25 |
+
ca-certificates \
|
| 26 |
ffmpeg \
|
| 27 |
libgl1 \
|
| 28 |
libglib2.0-0 \
|
|
|
|
| 30 |
libxext6 \
|
| 31 |
libxrender1 \
|
| 32 |
libgomp1 \
|
|
|
|
| 33 |
build-essential \
|
| 34 |
&& rm -rf /var/lib/apt/lists/* \
|
| 35 |
&& git lfs install
|
|
|
|
| 38 |
|
| 39 |
WORKDIR /app
|
| 40 |
|
| 41 |
+
RUN python -m pip install --upgrade pip setuptools wheel && \
|
| 42 |
+
python -m pip install \
|
| 43 |
+
"torch==2.7.1" \
|
| 44 |
+
"torchvision==0.22.1" \
|
| 45 |
+
"torchaudio==2.7.1" \
|
| 46 |
+
--index-url https://download.pytorch.org/whl/cpu
|
| 47 |
+
|
| 48 |
+
RUN git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git /app/ComfyUI && \
|
| 49 |
+
cd /app/ComfyUI && \
|
| 50 |
+
python -m pip install -r requirements.txt
|
| 51 |
+
|
| 52 |
+
# Keep the CPU PyTorch versions after installing ComfyUI requirements.
|
| 53 |
+
RUN python -m pip install --force-reinstall \
|
| 54 |
+
"torch==2.7.1" \
|
| 55 |
+
"torchvision==0.22.1" \
|
| 56 |
+
"torchaudio==2.7.1" \
|
| 57 |
+
--index-url https://download.pytorch.org/whl/cpu
|
| 58 |
+
|
| 59 |
+
# ------------------------------------------------------------------
|
| 60 |
+
# Seven custom nodes
|
| 61 |
+
# ------------------------------------------------------------------
|
| 62 |
+
RUN mkdir -p /app/ComfyUI/custom_nodes && \
|
| 63 |
+
cd /app/ComfyUI/custom_nodes && \
|
| 64 |
+
git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Manager.git comfyui-manager && \
|
| 65 |
+
git clone --depth 1 https://github.com/RealRebelAI/ComfyUI-GGUF_KREA-2.git ComfyUI-GGUF_KREA-2 && \
|
| 66 |
+
git clone --depth 1 https://github.com/crystian/comfyui-crystools.git comfyui-crystools && \
|
| 67 |
+
git clone --depth 1 https://github.com/rgthree/rgthree-comfy.git rgthree-comfy && \
|
| 68 |
+
git clone --depth 1 https://github.com/kijai/ComfyUI-KJNodes.git ComfyUI-KJNodes && \
|
| 69 |
+
git clone --depth 1 https://github.com/nicolab28/ComfyUI-ClipProj.git ComfyUI-ClipProj && \
|
| 70 |
+
git clone --depth 1 https://github.com/ethanfel/ComfyUI-Krea2TextEncoder.git ComfyUI-Krea2TextEncoder && \
|
| 71 |
+
git clone --depth 1 https://github.com/KLL535/ComfyUI_SimpleButcher.git ComfyUI_SimpleButcher && \
|
| 72 |
+
git clone --depth 1 https://github.com/lquesada/ComfyUI-Inpaint-CropAndStitch.git ComfyUI-Inpaint-CropAndStitch && \
|
| 73 |
+
git clone --depth 1 https://github.com/LAOGOU-666/Comfyui-Memory_Cleanup.git Comfyui-Memory_Cleanup && \
|
| 74 |
+
git clone --depth 1 https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git ComfyUI_UltimateSDUpscale && \
|
| 75 |
+
git clone --depth 1 https://github.com/ty0x2333/ComfyUI-Dev-Utils.git ComfyUI-Dev-Utils && \
|
| 76 |
+
git clone --depth 1 https://github.com/ServiceStack/comfy-asset-downloader.git comfy-asset-downloader && \
|
| 77 |
+
git clone --depth 1 https://github.com/traugdor/ComfyUI-UltimateSDUpscale-GGUF.git ComfyUI-UltimateSDUpscale-GGUF && \
|
| 78 |
+
git clone --depth 1 https://github.com/tori29umai0123/ComfyUI-Model_Downloader.git ComfyUI-Model_Downloader && \
|
| 79 |
+
git clone --depth 1 https://github.com/ciri/comfyui-model-downloader.git comfyui-model-downloader
|
| 80 |
+
|
| 81 |
+
RUN set -eux; \
|
| 82 |
+
find /app/ComfyUI/custom_nodes -maxdepth 2 -name "requirements.txt" -exec python -m pip install --no-cache-dir -r {} \;
|
| 83 |
+
|
| 84 |
+
RUN python -m pip install \
|
| 85 |
+
"huggingface_hub>=0.33" \
|
| 86 |
+
"hf_transfer>=0.1.9" \
|
| 87 |
psutil \
|
| 88 |
websocket-client \
|
| 89 |
opencv-python-headless \
|
|
|
|
| 96 |
dynamicprompts \
|
| 97 |
diffusers
|
| 98 |
|
| 99 |
+
# ------------------------------------------------------------------
|
| 100 |
+
# Runtime directories.
|
| 101 |
+
#
|
| 102 |
+
# IMPORTANT:
|
| 103 |
+
# ComfyUI 0.35.x creates /app/ComfyUI/user at startup.
|
| 104 |
+
# It must be writable by the non-root "user" account.
|
| 105 |
+
# ------------------------------------------------------------------
|
| 106 |
RUN mkdir -p \
|
| 107 |
+
/app/ComfyUI/user \
|
| 108 |
+
/app/ComfyUI/models/unet \
|
| 109 |
/app/ComfyUI/models/diffusion_models \
|
| 110 |
/app/ComfyUI/models/text_encoders \
|
| 111 |
+
/app/ComfyUI/models/clip \
|
| 112 |
/app/ComfyUI/models/vae \
|
| 113 |
/app/ComfyUI/models/loras \
|
| 114 |
/app/ComfyUI/models/upscale_models \
|
| 115 |
+
/app/ComfyUI/models/checkpoints \
|
| 116 |
+
/app/ComfyUI/workflows \
|
| 117 |
/app/ComfyUI/input \
|
| 118 |
/app/ComfyUI/output \
|
| 119 |
+
/app/ComfyUI/temp \
|
| 120 |
+
/data && \
|
| 121 |
+
chown -R user:user \
|
| 122 |
+
/app/ComfyUI/user \
|
| 123 |
+
/app/ComfyUI/models \
|
| 124 |
+
/app/ComfyUI/workflows \
|
| 125 |
+
/app/ComfyUI/input \
|
| 126 |
+
/app/ComfyUI/output \
|
| 127 |
+
/app/ComfyUI/temp \
|
| 128 |
+
/data
|
| 129 |
+
|
| 130 |
+
COPY --chown=user start.sh /app/start.sh
|
| 131 |
+
RUN chmod +x /app/start.sh && chown user:user /app/start.sh
|
| 132 |
|
| 133 |
USER user
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
WORKDIR /app/ComfyUI
|
| 136 |
|
| 137 |
+
ENV HOME=/home/user \
|
| 138 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 139 |
+
PYTHONPATH=/app/ComfyUI
|
| 140 |
+
|
| 141 |
+
# Build-time sanity check.
|
| 142 |
RUN python - <<'PY'
|
| 143 |
import torch
|
|
|
|
|
|
|
|
|
|
| 144 |
print("PyTorch:", torch.__version__)
|
| 145 |
print("CUDA available:", torch.cuda.is_available())
|
| 146 |
+
assert torch.__version__.startswith("2.7.1")
|
| 147 |
+
assert not torch.cuda.is_available()
|
| 148 |
+
|
| 149 |
+
import comfy_kitchen
|
| 150 |
print("comfy_kitchen:", comfy_kitchen.__file__)
|
| 151 |
print("int8_attention_is_available:",
|
| 152 |
hasattr(comfy_kitchen, "int8_attention_is_available"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
PY
|
| 154 |
|
| 155 |
COPY ./workflow /app/ComfyUI/user/default/workflows/
|
| 156 |
|
| 157 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=180s --retries=5 \
|
| 158 |
+
CMD curl -fsS http://127.0.0.1:7860/system_stats >/dev/null || exit 1
|
| 159 |
|
| 160 |
+
ENTRYPOINT ["/app/start.sh"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|