R1000 commited on
Commit
d78f71a
·
verified ·
1 Parent(s): c055474

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +67 -14
Dockerfile CHANGED
@@ -2,21 +2,74 @@ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # 1. ติดตั้ง System Dependencies ที่จำเป็นสำหรับ ComfyUI
6
- RUN apt-get update && apt-get install -y \
7
- git \
8
- wget \
9
- libgl1 \
10
- libglib2.0-0 \
11
- && rm -rf /var/lib/apt/lists/*
12
 
13
- # 2. โหลด Source Code ของ ComfyUI
14
- RUN git clone https://github.com/comfyanonymous/ComfyUI.git /app/ComfyUI
 
 
15
 
16
- WORKDIR /app/ComfyUI
 
 
17
 
18
- # 3. ติดตั้ง Python Dependencies (ขั้นตอนที่ขาดไป ทำให้เกิด Error alembic/sqlalchemy)
19
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
- # 4. รัน ComfyUI ในโหมดประหยัดทรัพยากร (CPU + Low VRAM)
22
- CMD ["python", "main.py", "--cpu", "--listen", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # 1. ติดตั้ง System Dependencies
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ git git-lfs curl ffmpeg libgl1 libglib2.0-0 wget \
8
+ && rm -rf /var/lib/apt/lists/* \
9
+ && git lfs install
 
 
10
 
11
+ # 2. ติดตั้ง PyTorch สำหรับ CPU เท่านั้น (ประหยัดพื้นที่และ RAM)
12
+ RUN pip install --no-cache-dir \
13
+ --extra-index-url https://download.pytorch.org/whl/cpu \
14
+ "torch==2.6.0" "torchvision==0.21.0" "torchaudio==2.6.0"
15
 
16
+ # 3. Clone ComfyUI และติดตั้ง Requirements หลัก
17
+ RUN git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git /app/ComfyUI \
18
+ && pip install --no-cache-dir -r /app/ComfyUI/requirements.txt
19
 
20
+ # 4. ติดตั้ง Custom Nodes ที่จำเป็น
21
+ RUN cd /app/ComfyUI/custom_nodes && \
22
+ git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Manager.git && \
23
+ git clone --depth 1 https://github.com/city96/ComfyUI-GGUF.git && \
24
+ git clone --depth 1 https://github.com/crystian/ComfyUI-Crystools && \
25
+ git clone --depth 1 https://github.com/rgthree/rgthree-comfy.git && \
26
+ git clone --depth 1 https://github.com/ty0x2333/ComfyUI-Dev-Utils.git && \
27
+ git clone --depth 1 https://github.com/XLabs-AI/x-flux-comfyui && \
28
+ git clone --depth 1 https://github.com/willmiao/ComfyUI-Lora-Manager && \
29
+ git clone --depth 1 https://github.com/kijai/ComfyUI-KJNodes.git && \
30
+ git clone --depth 1 https://github.com/lquesada/ComfyUI-Inpaint-CropAndStitch && \
31
+ git clone --depth 1 https://github.com/gseth/ControlAltAI-Nodes && \
32
+ git clone --depth 1 https://github.com/ssitu/ComfyUI_UltimateSDUpscale --recursive && \
33
+ git clone --depth 1 https://github.com/nicolab28/ComfyUI-ClipProj && \
34
+ git clone --depth 1 https://github.com/ethanfel/ComfyUI-Krea2TextEncoder && \
35
+ git clone --depth 1 https://github.com/LAOGOU-666/Comfyui-Memory_Cleanup && \
36
+ git clone --depth 1 https://github.com/KLL535/ComfyUI_SimpleButcher
37
 
38
+ # ติดตั้ง requirements ของ custom nodes บางตัวที่จำเป็น
39
+ RUN cd /app/ComfyUI/custom_nodes/ComfyUI-GGUF && pip install --no-cache-dir -r requirements.txt || true
40
+ RUN cd /app/ComfyUI/custom_nodes/ComfyUI-Crystools && pip install --no-cache-dir -r requirements.txt || true
41
+ RUN cd /app/ComfyUI/custom_nodes/rgthree-comfy && pip install --no-cache-dir -r requirements.txt || true
42
+ RUN cd /app/ComfyUI/custom_nodes/ComfyUI-KJNodes && pip install --no-cache-dir -r requirements.txt || true
43
+
44
+ # 5. ติดตั้ง Python Packages เพิ่มเติม (เพิ่ม color-matcher สำหรับ Node ColorMatch)
45
+ RUN pip install --no-cache-dir \
46
+ huggingface_hub psutil websocket-client opencv-python-headless \
47
+ einops transformers safetensors color-matcher
48
+
49
+ # 6. สร้างโครงสร้างโฟลเดอร์
50
+ RUN mkdir -p /app/ComfyUI/models/diffusion_models \
51
+ /app/ComfyUI/models/text_encoders \
52
+ /app/ComfyUI/models/vae \
53
+ /app/ComfyUI/models/loras \
54
+ /app/ComfyUI/models/upscale_models \
55
+ /app/ComfyUI/output
56
+
57
+ # 7. ดาวน์โหลดโมเดลที่ Workflow นี้ต้องการ (ใช้ wget แทน ADD เพื่อป้องกัน RAM พุ่ง)
58
+ RUN wget -c https://huggingface.co/lilcheaty/Krea2-INT8-ConvRot/resolve/main/Krea2-Turbo-int8-ConvRot.safetensors -P /app/ComfyUI/models/diffusion_models/ && \
59
+ wget -c https://huggingface.co/DreamFast/qwen3-4b-heretic/resolve/main/comfyui/qwen3-4b-heretic_nvfp4.safetensors -P /app/ComfyUI/models/text_encoders/ && \
60
+ wget -c https://huggingface.co/Comfy-Org/Krea-2/resolve/main/text_encoders/qwen3vl_4b_fp8_scaled.safetensors -P /app/ComfyUI/models/text_encoders/ && \
61
+ wget -c https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors -P /app/ComfyUI/models/vae/ && \
62
+ wget -c https://huggingface.co/Comfy-Org/flux2-dev/resolve/main/split_files/vae/flux2-vae.safetensors -P /app/ComfyUI/models/vae/ && \
63
+ wget -c https://huggingface.co/Comfy-Org/Krea-2/resolve/main/vae/qwen_image_vae.safetensors -P /app/ComfyUI/models/vae/ && \
64
+ wget -c https://huggingface.co/ABDALLALSWAITI/Upscalers/resolve/main/photo/4xNomosWebPhoto_RealPLKSR.pth -P /app/ComfyUI/models/upscale_models/
65
+
66
+ # ดาวน์โหลดโมเดลเพิ่มเติมที่ Workflow เรียกใช้ (หาก URL เปลี่ยนแปลง กรุณาตรวจสอบจาก Hugging Face)
67
+ RUN wget -c https://huggingface.co/Comfy-Org/flux2-klein-4B/resolve/main/split_files/diffusion_models/flux-2-klein-4b-nvfp4.safetensors -P /app/ComfyUI/models/diffusion_models/ || true
68
+ RUN wget -c https://huggingface.co/lvladikov/Krea2-Turbo-Distill-4step-LoRA/resolve/main/krea2_turbo_4step_rank_64_lora_comfyui.safetensors -P /app/ComfyUI/models/loras/ || true
69
+
70
+ # 8. Health Check
71
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
72
+ CMD curl -f http://localhost:7860/health || exit 1
73
+
74
+ # 9. คำสั่งเริ่มต้น (รัน ComfyUI บน CPU พร้อมบังคับจัดการหน่วยความจำ)
75
+ CMD ["python", "-u", "/app/ComfyUI/main.py", "--cpu", "--disable-smart-memory", "--listen", "0.0.0.0", "--port", "7860", "--output-directory", "/app/ComfyUI/output"]