File size: 6,693 Bytes
132165f
 
 
 
 
 
 
 
0aed098
132165f
 
 
 
 
 
d25045a
593773f
 
 
 
 
 
897c7b7
132165f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215cd66
 
132165f
 
5fe8be1
 
af83945
132165f
 
12179c9
49153b8
74ebaba
49153b8
 
dca23ce
12179c9
427b9c1
87e063f
159ea3f
 
3b0f49f
3b56733
ecfc3c3
75554fe
 
301e0f0
f34b8e1
 
fc92abd
1b810b3
132165f
7c7074d
18eb308
132165f
 
159ea3f
 
589dca4
7399ba9
b1dd00b
f4b6155
 
 
12179c9
 
 
 
 
0248a91
ccf77c4
f790a9f
87e063f
a3faa37
f790a9f
215cd66
7d8d9cb
6ccb27e
ccf77c4
221063f
62104f7
16fb27a
132165f
a8a63a9
132165f
 
 
 
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
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 sudo software-properties-common x11-xkb-utils \
    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-lfs  \
    ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx \
    && rm -rf /var/lib/apt/lists/* \
    && git lfs install

#RUN sudo apt update && sudo apt install apt-file -y
#RUN sudo apt-file update && sudo apt-file search add-apt-repository 
#RUN export DISPLAY=:0
#RUN setxkbmap jp
#xサーバーが必要なので、断念
#RUN sudo add-apt-repository ppa:graphics-drivers/ppa -y && sudo apt update -y && setxkbmap jp && apt list --upgradable && sudo apt install nvidia-driver-460 -y

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.9.17
# 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

# Clone the ComfyUI repo
RUN git clone https://github.com/comfyanonymous/ComfyUI . && \
    pip install --no-cache-dir -r requirements.txt 


RUN sed -i 's/weights_only=True/weights_only=False/g' ./comfy/utils.py
ARG HF_TOKEN
# Checkpoints
RUN echo "Downloading checkpoints..." && \ 
    # Kybalico Models
    # wget -c https://huggingface.co/Kybalico/CandyApple/resolve/main/candyApple_v12.safetensors -P ./models/checkpoints/ && \
    wget -cq https://huggingface.co/Kybalico/CalicoMix/resolve/main/calicoMix_v75.safetensors -P ./models/checkpoints/ && \
    # wget -c https://huggingface.co/Kybalico/CalicoMixDC/resolve/main/calicomix_dcV30.safetensors -P ./models/checkpoints/ && \
    # wget -c https://huggingface.co/Kybalico/AnmitsuMimimi/resolve/main/anmitsuMimimi_v10.safetensors -P ./models/checkpoints/ && \
    
    # TechnoByte Models
    wget -cq https://huggingface.co/TechnoByte/MilkyWonderland/resolve/main/milkyWonderland_v40.safetensors -P ./models/checkpoints/ && \
    # LCM
    #wget -O ./models/loras/lcm-lora-sdv1-5.safetensors https://huggingface.co/latent-consistency/lcm-lora-sdv1-5/resolve/main/pytorch_lora_weights.safetensors && \
    wget -O ./models/loras/v2-1_768-ema-pruned.safetensors https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.safetensors && \
    
    wget -O ./models/checkpoints/v1-5-pruned-emaonly.ckpt https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt && \
    
    #fubuki
    wget -O ./models/loras/fubuki-lora.safetensors https://huggingface.co/soiz1/shirakami-hubuki-diffusion/resolve/main/14329-shirakami-hubuki-diffusion.safetensors && \
    wget -O ./models/loras/fubuki-lora-mio.safetensors https://huggingface.co/soiz1/fubumio-fubuki-mio/resolve/main/1385098.safetensors && \
    #fox hand sign
    wget -O ./models/loras/Fox-hand-sign.safetensors https://civitai.com/api/download/models/1464140?type=Model&format=SafeTensor && \
    #FLUX
    wget -cq https://huggingface.co/datasets/soiz1/flux/resolve/main/flux1-dev.safetensors -P ./models/checkpoints/ && \
    # ControlNet
    # wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors -P ./models/controlnet/ && \
    wget -cq https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose.pth -P ./models/controlnet/ && \
    # GLIGEN
    # wget -c https://huggingface.co/comfyanonymous/GLIGEN_pruned_safetensors/resolve/main/gligen_sd14_textbox_pruned_fp16.safetensors -P ./models/gligen/ && \ 
    #vae
    wget -O ./models/vae/vae-ft-mse-840000-ema-pruned.ckpt https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt && \
    # ComfyUI Manager
    cd custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Manager.git ComfyUI-Manager && \
    cd ComfyUI-Manager/glob && sed -i '/def is_allowed_security_level/,/return/s/return.*/return True/' manager_server.py && \

    # Install custom nodes
    echo "Installing custom nodes..."
    
    # Controlnet Preprocessor nodes by Fannovel16
    # RUN cd custom_nodes && git clone https://github.com/Fannovel16/comfy_controlnet_preprocessors && cd comfy_controlnet_preprocessors && python install.py --no_download_ckpts 
    # 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 
    #COPY ./flux1-dev.safetensors /flux1-dev.safetensors
    RUN wget -cq https://huggingface.co/Bingsu/adetailer/resolve/main/hand_yolov8s.pt -P ./models/ultralytics/bbox
    RUN cd custom_nodes && git clone https://github.com/EllangoK/ComfyUI-post-processing-nodes --depth 1
    RUN cd custom_nodes && git clone https://github.com/jags111/efficiency-nodes-comfyui --depth 1
    RUN cd custom_nodes && git clone https://github.com/TinyTerra/ComfyUI_tinyterraNodes --depth 1
    RUN cd custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack --depth 1 && cd ComfyUI-Impact-Pack && python install.py
    RUN cd custom_nodes && git clone https://github.com/crystian/ComfyUI-Crystools --depth 1 && pip install -r ./ComfyUI-Crystools/requirements.txt
    RUN cd custom_nodes && git clone https://github.com/AIFSH/SeedVC-ComfyUI --depth 1 && pip install -r ./SeedVC-ComfyUI/requirements.txt
    RUN cd custom_nodes && git clone https://github.com/space-nuko/ComfyUI-OpenPose-Editor --depth 1
    COPY ./bad-hand.pickletensor ./models/embeddings/
    # RUN cd custom_nodes && git clone https://github.com/rgthree/rgthree-comfy --depth 1
  
    RUN echo "Done"

CMD ["python", "main.py", "--front-end-version=Comfy-Org/ComfyUI_legacy_frontend@latest", "--listen", "0.0.0.0", "--cpu", "--port", "7860", "--output-directory", "${USE_PERSISTENT_DATA:+/data/}"]