File size: 10,249 Bytes
b7e81e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fde4ed3
 
 
 
 
b7e81e5
fde4ed3
b7e81e5
 
 
 
 
ce4f327
 
cf13e2e
e3a23b8
cbd5c68
d726baa
eaa3f27
e3a23b8
ce45360
a4f838a
eaa3f27
ce4f327
a4f838a
cf13e2e
6f8b790
ce4f327
 
d726baa
2e76582
8517705
0f5d8b6
d726baa
0bcc13e
b6303ea
2f4a1ca
709439a
ce45360
cbd5c68
ce45360
cf13e2e
709439a
690363d
d726baa
 
 
dc955d8
33a062e
690363d
a593932
 
f0a97ed
5490912
 
d726baa
a593932
b7e81e5
 
 
 
 
 
e3a23b8
b7e81e5
 
 
 
 
fde4ed3
 
 
 
 
b7e81e5
 
 
efbace7
b93bc39
8afd924
d7769c4
b7e81e5
8afd924
884c852
dede64e
a593932
7590a00
dede64e
e3a23b8
ce45360
e3a23b8
b7e81e5
 
 
4b9544c
 
 
ed7c3fa
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
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04

ENV DEBIAN_FRONTEND=noninteractive \
    TZ=America/Los_Angeles

ARG USE_PERSISTENT_DATA

RUN apt-get update && apt-get install -y \
    git \
    make build-essential libssl-dev zlib1g-dev aria2 \
    libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
    libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git-lfs \
    ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx \
    && rm -rf /var/lib/apt/lists/* \
    && git lfs install

WORKDIR /code

COPY ./requirements.txt /code/requirements.txt

# User
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Pyenv
RUN curl https://pyenv.run | bash
ENV PATH=$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH

ARG PYTHON_VERSION=3.10
# Python
RUN pyenv install $PYTHON_VERSION && \
    pyenv global $PYTHON_VERSION && \
    pyenv rehash && \
    pip install --no-cache-dir --upgrade pip setuptools wheel && \
    pip install --no-cache-dir \
    datasets \
    huggingface-hub "protobuf<4" "click<8.1" && \
	pip install scikit-image && \
	pip install numba && \
	pip install dynamicprompts && \
	pip install diffusers
	#pip install huggingface_hub["cli"] && \
	#huggingface-cli delete-cache
	
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Set the working directory to /data if USE_PERSISTENT_DATA is set, otherwise set to $HOME/app
WORKDIR $HOME/app

# Clone the ComfyUI repo (fork with restart button)
# ARG CACHEBUST=1
# RUN git clone https://github.com/comfyanonymous/ComfyUI.git . && \
#    pip install --no-cache-dir -r requirements.txt 

# Clone the ComfyUI repo และล็อกเวอร์ชันที่ v0.28.0
RUN git clone https://github.com/comfyanonymous/ComfyUI.git . && \
    git checkout v0.28.0 && \
    pip install --no-cache-dir -r requirements.txt 

# Checkpoints

RUN echo "Downloading checkpoints..."  
#ADD --chown=user https://huggingface.co/mhnakif/flux-hyp8/resolve/main/flux-hyp8-Q8_0.gguf ./models/unet/
#ADD --chown=user https://huggingface.co/city96/FLUX.1-dev-gguf/resolve/main/flux1-dev-Q8_0.gguf ./models/unet/
#ADD --chown=user https://huggingface.co/city96/Qwen-Image-gguf/resolve/main/qwen-image-Q4_K_M.gguf ./models/unet/
#ADD --chown=user https://huggingface.co/unsloth/Z-Image-Turbo-GGUF/resolve/main/z-image-turbo-Q8_0.gguf ./models/unet/
#ADD --chown=user https://huggingface.co/unsloth/Z-Image-GGUF/resolve/main/z-image-Q8_0.gguf ./models/unet/
ADD --chown=user https://huggingface.co/unsloth/FLUX.2-klein-4B-GGUF/resolve/main/flux-2-klein-4b-Q8_0.gguf ./models/unet/
ADD --chown=user https://huggingface.co/unsloth/FLUX.2-klein-9B-GGUF/resolve/main/flux-2-klein-9b-Q8_0.gguf ./models/unet/
#ADD --chown=user https://huggingface.co/T5B/Z-Image-Turbo-FP8/resolve/main/z-image-turbo-fp8-e4m3fn.safetensors ./models/unet/

#ADD --chown=user https://huggingface.co/Wednesday-Hargreeves/flux-dev-fp8/resolve/main/flux1-dev-fp8.safetensors ./models/checkpoints/
#ADD --chown=user https://huggingface.co/Comfy-Org/ACE-Step_ComfyUI_repackaged/resolve/main/all_in_one/ace_step_v1_3.5b.safetensors ./models/checkpoints/
#ADD --chown=user https://huggingface.co/QuantStack/FLUX.1-Krea-dev-GGUF/resolve/main/flux1-krea-dev-Q8_0.gguf ./models/unet/
#ADD --chown=user https://huggingface.co/city96/FLUX.1-dev-gguf/resolve/main/flux1-dev-Q5_0.gguf ./models/unet/
#ADD --chown=user https://huggingface.co/bullerwins/FLUX.1-Kontext-dev-GGUF/resolve/main/flux1-kontext-dev-Q8_0.gguf ./models/unet/

#ADD --chown=user https://huggingface.co/zer0int/CLIP-GmP-ViT-L-14/resolve/main/ViT-L-14-TEXT-detail-improved-hiT-GmP-TE-only-HF.safetensors ./models/clip/
#ADD --chown=user https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/resolve/main/t5-v1_1-xxl-encoder-Q8_0.gguf ./models/clip/
ADD --chown=user https://huggingface.co/unsloth/Qwen3-4B-GGUF/resolve/main/Qwen3-4B-Q8_0.gguf ./models/clip/
#ADD --chown=user https://huggingface.co/Cordux/flux2-klein-4B-uncensored-text-encoder/resolve/main/qwen3-4b-abl-q4_0.gguf ./models/unet/
ADD --chown=user https://huggingface.co/Mungert/Qwen3-8B-abliterated-GGUF/resolve/main/Qwen3-8B-abliterated-q8_0.gguf ./models/text_encoders/
#ADD --chown=user https://huggingface.co/ponpoke/flux2-klein-9b-uncensored-text-encoder/resolve/main/flux2-klein-9b-uncensored-q8_0.gguf ./models/text_encoders/
ADD --chown=user https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/text_encoders/qwen_3_4b_fp4_mixed.safetensors ./models/text_encoders/
ADD --chown=user https://huggingface.co/unsloth/Qwen3-8B-GGUF/resolve/main/Qwen3-8B-Q8_0.gguf ./models/text_encoders/

#ADD --chown=user https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors ./models/vae/
ADD --chown=user https://huggingface.co/receptektas/black-forest-labs-ae_safetensors/resolve/main/ae.safetensors ./models/vae/
ADD --chown=user https://huggingface.co/Owen777/UltraFlux-v1/resolve/main/vae/diffusion_pytorch_model.safetensors ./models/vae/Ultra-Flux-V1.safetensors
ADD --chown=user https://huggingface.co/Comfy-Org/flux2-dev/resolve/main/split_files/vae/flux2-vae.safetensors ./models/vae/

#ADD --chown=user https://huggingface.co/Comfy-Org/Qwen-Image_ComfyUI/resolve/main/split_files/vae/qwen_image_vae.safetensors ./models/vae/
#RUN wget -c https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors -P ./models/vae/

ADD --chown=user https://huggingface.co/prithivMLmods/Canopus-LoRA-Flux-UltraRealism-2.0/resolve/main/Canopus-LoRA-Flux-UltraRealism.safetensors ./models/loras/Flux-UltraRealism.safetensors
ADD --chown=user https://huggingface.co/akash-guptag/NSFW-Flux-Lora/resolve/main/aidmaNSFWunlock-FLUX-V0.2.safetensors ./models/loras/
ADD --chown=user https://huggingface.co/camenduru/FLUX.1-dev/resolve/fc63f3204a12362f98c04bc4c981a06eb9123eee/FLUX.1-Turbo-Alpha.safetensors ./models/loras/FLUX.1-Turbo-Alpha.safetensors
#RUN wget -q https://civitai.com/api/download/models/2510875 -O ./models/loras/breast.safetensors
ADD --chown=user https://huggingface.co/latent-consistency/lcm-lora-sdxl/resolve/main/pytorch_lora_weights.safetensors ./models/loras/lcm-sdxl.safetensors

ADD --chown=user https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart.pth ./models/controlnet/
ADD --chown=user https://huggingface.co/Hex820000/anime_v10/resolve/main/anime_v10.safetensors ./models/checkpoints/
ADD --chown=user https://huggingface.co/SG161222/RealVisXL_V5.0_Lightning/resolve/main/RealVisXL_V5.0_Lightning_fp16.safetensors ./models/checkpoints/
ADD --chown=user https://huggingface.co/SG161222/Realistic_Vision_V6.0_B1_noVAE/resolve/main/Realistic_Vision_V6.0_NV_B1_fp16.safetensors ./models/checkpoints/
ADD --chown=user https://huggingface.co/IbarakiDouji/WAI-NSFW-illustrious-SDXL/resolve/main/waiIllustriousSDXL_v170.safetensors ./models/checkpoints/
ADD --chown=user https://huggingface.co/Lykon/dreamshaper-xl-v2-turbo/resolve/main/DreamShaperXL_Turbo_V2-SFW.safetensors ./models/checkpoints/

RUN wget -c https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P ./models/upscale_models/ 
RUN wget -c https://huggingface.co/sberbank-ai/Real-ESRGAN/resolve/main/RealESRGAN_x2.pth -P ./models/upscale_models/ 
RUN wget -c https://huggingface.co/sberbank-ai/Real-ESRGAN/resolve/main/RealESRGAN_x4.pth -P ./models/upscale_models/ 
RUN wget -c https://huggingface.co/Acly/Omni-SR/resolve/main/OmniSR_X2_DIV2K.safetensors -P ./models/upscale_models/
RUN wget -c https://huggingface.co/Acly/Omni-SR/resolve/main/OmniSR_X3_DIV2K.safetensors -P ./models/upscale_models/
RUN wget -c https://huggingface.co/Acly/Omni-SR/resolve/main/OmniSR_X4_DIV2K.safetensors -P ./models/upscale_models/


RUN echo "Done"

# instal custom nodes
RUN echo "Installing custom nodes..." 
# RUN cd custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Manager.git
# ติดตั้ง ComfyUI-Manager และล็อกเวอร์ชัน
RUN cd custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Manager.git && \
    cd ComfyUI-Manager && git checkout v3.40

RUN cd custom_nodes && git clone https://github.com/crystian/ComfyUI-Crystools && cd ComfyUI-Crystools && pip install -r requirements.txt
RUN cd custom_nodes && git clone https://github.com/rgthree/rgthree-comfy.git && cd rgthree-comfy && pip install -r requirements.txt
RUN cd custom_nodes && git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts
RUN cd custom_nodes && git clone https://github.com/welltop-cn/ComfyUI-TeaCache.git
RUN cd custom_nodes && git clone https://github.com/ty0x2333/ComfyUI-Dev-Utils.git && cd ComfyUI-Dev-Utils && pip install -r requirements.txt
RUN cd custom_nodes && git clone https://github.com/ssitu/ComfyUI_UltimateSDUpscale --recursive
RUN cd custom_nodes && git clone https://github.com/chengzeyi/Comfy-WaveSpeed.git
RUN cd custom_nodes && git clone https://github.com/city96/ComfyUI-GGUF && cd ComfyUI-GGUF && pip install -r requirements.txt
RUN cd custom_nodes && git clone https://github.com/XLabs-AI/x-flux-comfyui && cd x-flux-comfyui && pip install -r requirements.txt
RUN cd custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes && cd ComfyUI-KJNodes && pip install -r requirements.txt
RUN cd custom_nodes && git clone https://github.com/gseth/ControlAltAI-Nodes
RUN cd custom_nodes && git clone https://github.com/Fannovel16/comfyui_controlnet_aux && cd comfyui_controlnet_aux && pip install -r requirements.txt
RUN cd custom_nodes && git clone https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet
RUN cd custom_nodes && git clone https://github.com/willmiao/ComfyUI-Lora-Manager && cd ComfyUI-Lora-Manager && pip install -r requirements.txt

RUN cd custom_nodes && git clone https://github.com/kijai/ComfyUI-Florence2.git
RUN wget -c https://huggingface.co/ljnlonoljpiljm/florence-2-base-nsfw-v2/resolve/main/model.safetensors -P ./models/llm/Florence-2-base-ft/

RUN echo "Done"

HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
   CMD curl -f http://localhost:7860/health || exit 1

CMD ["python", "main.py", "--cpu", "--listen", "0.0.0.0", "--port", "7860", "--output-directory", "${USE_PERSISTENT_DATA:+/data/}"]