diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index f813c68..c784f16 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -4,6 +4,15 @@ ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 RUN apt-get update && apt-get install -y git && apt-get clean +# add some packages for some custom nodes in comfyui +RUN apt-get install 'libglib2.0-0' -y +RUN apt-get update +RUN apt-get install 'libgl1-mesa-glx' -y +RUN apt-get install 'python-dev' -y + +# install pip package for codeformer face detection custom node +RUN pip install lpips + ENV ROOT=/stable-diffusion RUN --mount=type=cache,target=/root/.cache/pip \ git clone https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \ @@ -13,6 +22,15 @@ RUN --mount=type=cache,target=/root/.cache/pip \ pip install -r requirements.txt WORKDIR ${ROOT} + +ARG BRANCH=master SHA=c97be4db91d4a249c19afdf88fa1cf3268544e45 +RUN --mount=type=cache,target=/root/.cache/pip \ + git fetch && \ + git checkout ${BRANCH} && \ + git reset --hard ${SHA} && \ + pip install -r requirements.txt + +# add info COPY . /docker/ RUN chmod u+x /docker/entrypoint.sh && cp /docker/extra_model_paths.yaml ${ROOT} diff --git a/services/comfy/entrypoint.sh b/services/comfy/entrypoint.sh index b4299a7..e411fb5 100755 --- a/services/comfy/entrypoint.sh +++ b/services/comfy/entrypoint.sh @@ -10,6 +10,34 @@ MOUNTS["/root/.cache"]="/data/.cache" MOUNTS["${ROOT}/input"]="/data/config/comfy/input" MOUNTS["${ROOT}/output"]="/output/comfy" +# mount various locations for comfyui to keep custom nodes and models downloaded with comfyui manager +MOUNTS["${ROOT}/custom_nodes"]="/data/config/comfy/custom_nodes" + +MOUNTS["${ROOT}/models/checkpoints"]="/data/models/checkpoints" +#MOUNTS["${ROOT}/models/configs"]="/data/models/configs" +MOUNTS["${ROOT}/models/embeddings"]="/data/models/embeddings" +MOUNTS["${ROOT}/models/gligen"]="/data/models/gligen" +MOUNTS["${ROOT}/models/mmdets"]="/data/models/mmdets" +MOUNTS["${ROOT}/models/style_models"]="/data/models/style_models" +#MOUNTS["${ROOT}/models/vae"]="/data/models/vae" +#MOUNTS["${ROOT}/models/clip"]="/data/models/clip" +#MOUNTS["${ROOT}/models/controlnet"]="/data/models/controlnet" +MOUNTS["${ROOT}/models/facedetection"]="/data/models/facedetection" + +MOUNTS["${ROOT}/models/hypernetworks"]="/data/models/hypernetworks" + + +#MOUNTS["${ROOT}/models/onnx"]="/data/models/onnx" +#MOUNTS["${ROOT}/models/unet"]="/data/models/unet" +MOUNTS["${ROOT}/models/vae_approx"]="/data/models/vae-approx" +#MOUNTS["${ROOT}/models/clip_vision"]="/data/models/clip_vision" +#MOUNTS["${ROOT}/models/diffusers"]="/data/models/diffusers" +MOUNTS["${ROOT}/models/facerestore_models"]="/data/models/facerestore_models" +MOUNTS["${ROOT}/models/loras"]="/data/models/lora" +MOUNTS["${ROOT}/models/sams"]="/data/models/sams" +MOUNTS["${ROOT}/models/upscale_models"]="/data/models/upscale_models" + + for to_path in "${!MOUNTS[@]}"; do set -Eeuo pipefail from_path="${MOUNTS[${to_path}]}" diff --git a/services/comfy/extra_model_paths.yaml b/services/comfy/extra_model_paths.yaml index eb374eb..c06cd46 100644 --- a/services/comfy/extra_model_paths.yaml +++ b/services/comfy/extra_model_paths.yaml @@ -4,7 +4,7 @@ a111: checkpoints: models/Stable-diffusion configs: models/Stable-diffusion vae: models/VAE - loras: models/Lora + #loras: models/Lora upscale_models: | models/RealESRGAN models/ESRGAN @@ -16,10 +16,24 @@ a111: clip: models/CLIPEncoder embeddings: embeddings - custom_nodes: config/comfy/custom_nodes + #custom_nodes: config/comfy/custom_nodes # TODO: I am unsure about these, need more testing # style_models: config/comfy/style_models # t2i_adapter: config/comfy/t2i_adapter # clip_vision: config/comfy/clip_vision # diffusers: config/comfy/diffusers + +# may not need these since I'm adding mounts instead + #facerestore_models: models/facerestore_models + #sams: models/sams + #unet: models/unet + #vae_approx: models/vae_approx + #face_restore: models/face_restore + #mmdets: models/mmdets + #style_models: models/style_models + #clip_vision: models/clip_vision + #diffusers: models/diffusers + #facedetection: models/facedetection + #onnx: models/onnx + #ultralytics: models/ultralytics \ No newline at end of file