File size: 7,462 Bytes
ca49949
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d6b0051
 
 
 
 
 
 
 
6c5c9a0
ca49949
 
 
 
 
 
6c5c9a0
 
 
 
ca49949
 
 
 
 
6c5c9a0
 
 
ca49949
 
 
 
6c5c9a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ca49949
 
 
 
 
 
 
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
FROM nvidia/cuda:12.1.1-cudnn8-devel-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 \
    libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
    libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git 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.12
# 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"

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

# Copy the current directory contents into the container at $HOME/app setting the owner to the user

RUN git clone https://github.com/comfyanonymous/ComfyUI . && git checkout c6951548cfec64c28082e6560c69c59e32729c9c && \
    pip install xformers!=0.0.18 --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu121

# Checkpoints

RUN echo "Downloading checkpoints..."  
RUN wget -c https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors -P ./models/checkpoints/ 
RUN wget -c https://huggingface.co/stabilityai/sdxl-turbo/resolve/main/sd_xl_turbo_1.0.safetensors -P ./models/checkpoints/ 
RUN wget -c https://huggingface.co/SG161222/RealVisXL_V4.0_Lightning/resolve/main/RealVisXL_V4.0_Lightning.safetensors -P ./models/checkpoints/ 
RUN wget -c https://huggingface.co/SG161222/RealVisXL_V3.0_Turbo/resolve/main/RealVisXL_V3.0_Turbo.safetensors -P ./models/checkpoints/ 
RUN wget -c https://huggingface.co/RunDiffusion/Juggernaut-XL-Lightning/resolve/main/Juggernaut_RunDiffusionPhoto2_Lightning_4Steps.safetensors -P ./models/checkpoints/ 
RUN wget -c https://huggingface.co/Lykon/dreamshaper-xl-lightning/resolve/main/DreamShaperXL_Lightning.safetensors -P ./models/checkpoints/ 
RUN wget -c https://huggingface.co/Lykon/dreamshaper-xl-v2-turbo/resolve/main/DreamShaperXL_Turbo_v2_1.safetensors -P ./models/checkpoints/ 
RUN wget -c https://huggingface.co/Lykon/DreamShaper/resolve/main/DreamShaper_8_INPAINTING.inpainting.safetensors -P ./models/checkpoints/ 
RUN wget -c https://huggingface.co/Lykon/DreamShaper/resolve/main/DreamShaper_8_pruned.safetensors -P ./models/checkpoints/ 

RUN echo "Downloading Controlnet..."  

RUN wget -c https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -P ./models/vae/ 
RUN wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-canny-rank256.safetensors -P ./models/controlnet/ 
RUN wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-depth-rank256.safetensors -P ./models/controlnet/ 
RUN wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-recolor-rank256.safetensors -P ./models/controlnet/ 
RUN wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank256/control-lora-sketch-rank256.safetensors -P ./models/controlnet/ 
RUN wget -c https://huggingface.co/ArtGAN/Controlnet/resolve/main/controlnet-sdxl-canny-mid.safetensors -P ./models/controlnet/
RUN wget -c https://huggingface.co/ArtGAN/Controlnet/resolve/main/controlnet-sdxl-depth-mid.safetensors -P ./models/controlnet/

RUN echo "Downloading Upscaler..."  

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/ArtGAN/Controlnet/resolve/main/lcm-lora-sdv1-5.safetensors -P ./models/loras/ 
RUN wget -c https://huggingface.co/ArtGAN/Controlnet/resolve/main/lcm-lora-sdxl.safetensors -P ./models/loras/ 

RUN echo "Done"

# instal custom nodes
RUN echo "Installing custom nodes..." 

RUN cd custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Manager.git
RUN cd custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack && cd ComfyUI-Impact-Pack && python install.py
RUN cd custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Inspire-Pack && cd ComfyUI-Inspire-Pack && python install.py
RUN cd custom_nodes && git clone https://github.com/Fannovel16/ComfyUI-Frame-Interpolation && cd ComfyUI-Frame-Interpolation && python install.py
RUN cd custom_nodes && git clone https://github.com/Fannovel16/ComfyUI-Video-Matting && cd ComfyUI-Video-Mattin && python install.py
RUN cd custom_nodes && git clone https://github.com/biegert/ComfyUI-CLIPSeg && cd ComfyUI-CLIPSeg && python install.py
RUN cd custom_nodes && git clone https://github.com/BlenderNeko/ComfyUI_Cutoff && cd ComfyUI_Cutoff && python install.py
RUN cd custom_nodes && git clone https://github.com/WASasquatch/PPF_Noise_ComfyUI && cd PPF_Noise_ComfyUI && python install.py
RUN cd custom_nodes && git clone https://github.com/WASasquatch/PowerNoiseSuite && cd PowerNoiseSuite && python install.py
RUN cd custom_nodes && git clone https://github.com/Jordach/comfy-plasma && cd comfy-plasma && python install.py
RUN cd custom_nodes && git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes && cd ComfyUI_Comfyroll_CustomNodes && python install.py
RUN cd custom_nodes && git clone https://github.com/space-nuko/ComfyUI-OpenPose-Editor && cd ComfyUI-OpenPose-Editor && python install.py
RUN cd custom_nodes && git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus && cd ComfyUI_IPAdapter_plus && python install.py
RUN cd custom_nodes && git clone https://github.com/twri/sdxl_prompt_styler && cd sdxl_prompt_styler && python install.py 
RUN cd custom_nodes && git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved && cd ComfyUI-AnimateDiff-Evolved && python install.py
RUN cd custom_nodes && git clone https://github.com/AIrjen/OneButtonPrompt && cd OneButtonPrompt && python install.py
RUN cd custom_nodes && git clone https://github.com/gokayfem/ComfyUI_VLM_nodes && cd ComfyUI_VLM_nodes && python install.py
RUN cd custom_nodes && git clone https://github.com/Fannovel16/comfy_controlnet_preprocessors && cd comfy_controlnet_preprocessors && python install.py
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/Stability-AI/stability-ComfyUI-nodes && cd stability-ComfyUI-nodes && pip install -r requirements.txt 


RUN echo "Done"

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