ComfyUI / Dockerfile
zac's picture
Update Dockerfile
b882d0f
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 \
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.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 . && \
pip install xformers!=0.0.18 --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu117
# Checkpoints
RUN echo "Downloading checkpoints..."
# SDXL
COPY ./leosamsHelloworldSDXLModel_helloworldSDXL10.safetensors ./models/checkpoints/leosamsHelloworldSDXLModel_helloworldSDXL10.safetensors
COPY ./counterfeitxl_v10.safetensors ./models/checkpoints/counterfeitxl_v10.safetensors
COPY ./formulaxlXLComfyui_v20Pruned.safetensors ./models/checkpoints/formulaxlXLComfyui_v20Pruned.safetensors
#RUN wget -c https://civitai.com/api/download/models/150851 -O ./models/checkpoints/leosamsHelloworldSDXLModel_helloworldSDXL10.safetensors
#RUN wget -c https://civitai.com/api/download/models/146761 -O ./models/checkpoints/counterfeitxl_v10.safetensors
#RUN wget -c https://civitai.com/api/download/models/148171 -P ./models/checkpoints/
# RUN wget -c https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors -P ./models/checkpoints/
# SD1.5
# RUN wget -c https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt -P ./models/checkpoints/
#RUN wget -c https://huggingface.co/stabilityai/stable-diffusion-2-1-base/resolve/main/v2-1_512-ema-pruned.safetensors -P ./models/checkpoints/
# RUN wget -c https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.safetensors -P ./models/checkpoints/
# Some SD1.5 anime style
#RUN wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix2/AbyssOrangeMix2_hard.safetensors -P ./models/checkpoints/
# RUN wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3A1_orangemixs.safetensors -P ./models/checkpoints/
# RUN wget -c https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3A3_orangemixs.safetensors -P ./models/checkpoints/
# RUN wget -c https://huggingface.co/Linaqruf/anything-v3.0/resolve/main/anything-v3-fp16-pruned.safetensors -P ./models/checkpoints/
# Waifu Diffusion 1.5 (anime style SD2.x 768-v)
# RUN wget -c https://huggingface.co/waifu-diffusion/wd-1-5-beta2/resolve/main/checkpoints/wd-1-5-beta2-fp16.safetensors -P ./models/checkpoints/
# unCLIP models
# RUN wget -c https://huggingface.co/comfyanonymous/illuminatiDiffusionV1_v11_unCLIP/resolve/main/illuminatiDiffusionV1_v11-unclip-h-fp16.safetensors -P ./models/checkpoints/
# RUN wget -c https://huggingface.co/comfyanonymous/wd-1.5-beta2_unCLIP/resolve/main/wd-1-5-beta2-aesthetic-unclip-h-fp16.safetensors -P ./models/checkpoints/
# ---
# VAE
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/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt -P ./models/vae/
# RUN wget -c https://huggingface.co/hakurei/waifu-diffusion-v1-4/resolve/main/vae/kl-f8-anime2.ckpt -P ./models/vae/
# Loras
#COPY ./attire_spider-man-12.safetensors ./models/loras/attire_spider-man-12.safetensors
COPY ./SDXL_crumpled_paper_Sa_May_V2.safetensors ./models/loras/SDXL_crumpled_paper_Sa_May_V2.safetensors
COPY ./StickersRedmond.safetensors ./models/loras/StickersRedmond.safetensors
COPY ./RW_pixelart_XL_v1.safetensors ./models/loras/RW_pixelart_XL_v1.safetensors
COPY ./xxmix0731girl.safetensors ./models/loras/xxmix0731girl.safetensors
COPY ./katiekones_v1.safetensors ./models/loras/katiekones_v1.safetensors
COPY ./xl_victorian_maid_dress-1.0.safetensors ./models/loras/xl_victorian_maid_dress-1.0.safetensors
COPY ./polyhedron_all_sdxl-000004.safetensors ./models/loras/polyhedron_all_sdxl-000004.safetensors
COPY ./eyesize.pt ./models/loras/eyesize.pt
#Embeddings
COPY ./NegfeetV2.pt ./models/embedding/NegfeetV2.pt
COPY ./epiCNegative.pt ./models/embedding/epiCNegative.pt
COPY ./badhandv4.pt ./models/embedding/badhandv4.pt
RUN wget -c https://civitai.com/api/download/models/77307 -O ./models/loras/attire_spider-man-12.safetensors
#RUN wget -c https://civitai.com/api/download/models/145048 -O ./models/loras/SDXL_crumpled_paper_Sa_May_V2.safetensors
# RUN wget -c https://civitai.com/api/download/models/141094 -O ./models/loras/Cyberpunk_Anime_sdxl.safetensors
#RUN wget -c https://civitai.com/api/download/models/123593 -O ./models/loras/RW_pixelart_XL_v1.safetensors
# RUN wget -c https://civitai.com/api/download/models/10350 -O ./models/loras/theovercomer8sContrastFix_sd21768.safetensors #theovercomer8sContrastFix SD2.x 768-v
# RUN wget -c https://civitai.com/api/download/models/10638 -O ./models/loras/theovercomer8sContrastFix_sd15.safetensors #theovercomer8sContrastFix SD1.x
# T2I-Adapter
#RUN git lfs install
#RUN git clone https://huggingface.co/lllyasviel/sd_control_collection.git ./models/controlnet
#CMD ["git lfs install", "git clone https://huggingface.co/lllyasviel/sd_control_collection.git ./models/controlnet/"]
COPY ./TencentARC_t2i-adapter-depth-midas-sdxl-1.0.safetensors ./models/controlnet/TencentARC_t2i-adapter-depth-midas-sdxl-1.0.safetensors
COPY ./TencentARC_t2i-adapter-depth-zoe-sdxl-1.0.safetensors ./models/controlnet/TencentARC_t2i-adapter-depth-zoe-sdxl-1.0.safetensors
COPY ./TencentARC_t2i-adapter-openpose-sdxl-1.0.safetensors ./models/controlnet/TencentARC_t2i-adapter-openpose-sdxl-1.0.safetensors
COPY ./TencentARC_t2i-adapter-sketch-sdxl-1.0.safetensors ./models/controlnet/TencentARC_t2i-adapter-sketch-sdxl-1.0.safetensors
# RUN wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_depth_sd14v1.pth -P ./models/controlnet/
#RUN wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_seg_sd14v1.pth -P ./models/controlnet/
# RUN wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_sketch_sd14v1.pth -P ./models/controlnet/
# RUN wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_keypose_sd14v1.pth -P ./models/controlnet/
# RUN wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_openpose_sd14v1.pth -P ./models/controlnet/
# RUN wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_color_sd14/v1.pth -P ./models/controlnet/
# RUN wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_canny_sd14v1.pth -P ./models/controlnet/
# T2I Styles Model
# RUN wget -c https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_style_sd14v1.pth -P ./models/style_models/
# CLIPVision model (needed for styles model)
# RUN wget -c https://huggingface.co/openai/clip-vit-large-patch14/resolve/main/pytorch_model.bin -O ./models/clip_vision/clip_vit14.bin
# ControlNet
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_canny_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors -P ./models/controlnet/
#RUN wget -c https://huggingface.co/thibaud/controlnet-sd21/resolve/main/control_v11p_sd21_lineart.safetensors -P ./models/controlnet/
#RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_lineart_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_openpose_fp16.safetensors -P ./models/controlnet/
#RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_scribble_fp16.safetensors -P ./models/controlnet/
RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_seg_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_softedge_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors -P ./models/controlnet/
# RUN wget -c https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11u_sd15_tile_fp16.safetensors -P ./models/controlnet/
#RUN wget -c https://huggingface.co/thibaud/controlnet-openpose-sdxl-1.0/resolve/main/OpenPoseXL2.safetensors -P ./models/controlnet/
# https://huggingface.co/stabilityai/control-lora
RUN wget -c https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/diffusers_xl_canny_full.safetensors -P ./models/controlnet/
RUN wget -c https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/diffusers_xl_depth_full.safetensors -P ./models/controlnet/
RUN wget -c https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/ip-adapter_xl.pth -P ./models/controlnet/
RUN wget -c https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_diffusers_xl_sketch.safetensors -P ./models/controlnet/
#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/stabilityai/control-lora/resolve/main/control-LoRAs-rank128/control-lora-canny-rank128.safetensors -P ./models/controlnet/
#RUN wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank128/control-lora-depth-rank128.safetensors -P ./models/controlnet/
#RUN wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank128/control-lora-recolor-rank128.safetensors -P ./models/controlnet
#RUN wget -c https://huggingface.co/stabilityai/control-lora/resolve/main/control-LoRAs-rank128/control-lora-sketch-rank128-metadata.safetensors -P ./models/controlnet/
RUN wget -c https://huggingface.co/thibaud/controlnet-openpose-sdxl-1.0/resolve/main/diffusion_pytorch_model.bin -O ./models/controlnet/OpenPoseXL2.bin
# GLIGEN
RUN wget -c https://huggingface.co/comfyanonymous/GLIGEN_pruned_safetensors/resolve/main/gligen_sd14_textbox_pruned_fp16.safetensors -P ./models/gligen/
# ESRGAN upscale model
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 echo "Done"
# instal custom nodes
RUN 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
RUN cd custom_nodes && git clone https://github.com/EllangoK/ComfyUI-post-processing-nodes.git
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.git
RUN cd custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui.git
RUN cd custom_nodes && git clone https://github.com/biegert/ComfyUI-CLIPSeg.git
# ComfyUI Manager
# RUN cd custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Manager.git
RUN echo "Done"
CMD ["python", "main.py", "--listen", "0.0.0.0", "--port", "7860", "--output-directory", "${USE_PERSISTENT_DATA:+/data/}"]