This commit is contained in:
digitallamb 2025-07-15 22:49:49 +00:00 committed by GitHub
commit 09c2a7eabd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 170 additions and 2 deletions

View file

@ -26,6 +26,14 @@ This repository provides multiple UIs for you to play around with stable diffusi
| -------------------------------------------------------------------------------- | | -------------------------------------------------------------------------------- |
| ![](https://github.com/comfyanonymous/ComfyUI/raw/master/comfyui_screenshot.png) | | ![](https://github.com/comfyanonymous/ComfyUI/raw/master/comfyui_screenshot.png) |
### [Fooocus](https://github.com/comfyanonymous/ComfyUI)
[Full feature list here](https://github.com/lllyasviel/Fooocus#fooocus), Screenshot:
| Simplified UI |
| -------------------------------------------------------------------------------- |
| ![](https://github.com/lllyasviel/Fooocus/assets/19834515/483fb86d-c9a2-4c20-997c-46dafc124f25) |
## Contributing ## Contributing
Contributions are welcome! **Create a discussion first of what the problem is and what you want to contribute (before you implement anything)** Contributions are welcome! **Create a discussion first of what the problem is and what you want to contribute (before you implement anything)**

View file

@ -53,3 +53,11 @@ services:
deploy: {} deploy: {}
environment: environment:
- CLI_ARGS=--cpu - CLI_ARGS=--cpu
fooocus: &fooocus
<<: *base_service
profiles: ["fooocus"]
build: ./services/fooocus/
image: sd-fooocus:3
environment:
- CLI_ARGS=

View file

@ -4,6 +4,15 @@ ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1
RUN apt-get update && apt-get install -y git && apt-get clean 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 ENV ROOT=/stable-diffusion
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip \
git clone https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \ 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 pip install -r requirements.txt
WORKDIR ${ROOT} 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/ COPY . /docker/
RUN chmod u+x /docker/entrypoint.sh && cp /docker/extra_model_paths.yaml ${ROOT} RUN chmod u+x /docker/entrypoint.sh && cp /docker/extra_model_paths.yaml ${ROOT}

View file

@ -10,6 +10,34 @@ MOUNTS["/root/.cache"]="/data/.cache"
MOUNTS["${ROOT}/input"]="/data/config/comfy/input" MOUNTS["${ROOT}/input"]="/data/config/comfy/input"
MOUNTS["${ROOT}/output"]="/output/comfy" 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 for to_path in "${!MOUNTS[@]}"; do
set -Eeuo pipefail set -Eeuo pipefail
from_path="${MOUNTS[${to_path}]}" from_path="${MOUNTS[${to_path}]}"

View file

@ -4,7 +4,7 @@ a111:
checkpoints: models/Stable-diffusion checkpoints: models/Stable-diffusion
configs: models/Stable-diffusion configs: models/Stable-diffusion
vae: models/VAE vae: models/VAE
loras: models/Lora #loras: models/Lora
upscale_models: | upscale_models: |
models/RealESRGAN models/RealESRGAN
models/ESRGAN models/ESRGAN
@ -16,10 +16,24 @@ a111:
clip: models/CLIPEncoder clip: models/CLIPEncoder
embeddings: embeddings embeddings: embeddings
custom_nodes: config/comfy/custom_nodes #custom_nodes: config/comfy/custom_nodes
# TODO: I am unsure about these, need more testing # TODO: I am unsure about these, need more testing
# style_models: config/comfy/style_models # style_models: config/comfy/style_models
# t2i_adapter: config/comfy/t2i_adapter # t2i_adapter: config/comfy/t2i_adapter
# clip_vision: config/comfy/clip_vision # clip_vision: config/comfy/clip_vision
# diffusers: config/comfy/diffusers # 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

View file

@ -0,0 +1,47 @@
FROM alpine:3.17 as xformers
RUN apk add --no-cache aria2
RUN aria2c -x 5 --dir / --out wheel.whl 'https://github.com/AbdBarho/stable-diffusion-webui-docker/releases/download/6.0.0/xformers-0.0.21.dev544-cp310-cp310-manylinux2014_x86_64-pytorch201.whl'
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1
RUN apt-get update && apt-get install -y git && apt-get clean
# add in required packages
RUN apt-get install 'libglib2.0-0' -y
RUN apt-get install 'libgl1-mesa-glx' -y
RUN apt-get install 'python-dev' -y
# set this to your target branch commit
ARG BRANCH=main SHA=d7439b2d6004d50a0fda19108603a8d1941a185e
ENV ROOT=/stable-diffusion
RUN --mount=type=cache,target=/root/.cache/pip \
git clone https://github.com/lllyasviel/Fooocus.git ${ROOT} && \
cd ${ROOT} && \
git checkout ${BRANCH} && \
git reset --hard ${SHA} && \
pip install -r requirements_versions.txt
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,from=xformers,source=/wheel.whl,target=/xformers-0.0.21-cp310-cp310-linux_x86_64.whl \
pip install /xformers-0.0.21-cp310-cp310-linux_x86_64.whl
WORKDIR ${ROOT}
RUN --mount=type=cache,target=/root/.cache/pip \
git fetch && \
git checkout ${BRANCH} && \
git reset --hard ${SHA} && \
pip install -r requirements_versions.txt
# add info
COPY . /docker/
RUN cp /docker/config.txt ${ROOT}
RUN chmod u+x /docker/entrypoint.sh
EXPOSE 7860
ENTRYPOINT ["/docker/entrypoint.sh"]
CMD python -u entry_with_update.py --listen --port 7860 ${CLI_ARGS}

View file

@ -0,0 +1,12 @@
{
"path_checkpoints": "/stable-diffusion/models/checkpoints",
"path_loras": "/stable-diffusion/models/loras",
"path_embeddings": "/stable-diffusion/models/embeddings",
"path_vae_approx": "/stable-diffusion/models/vae_approx",
"path_upscale_models": "/stable-diffusion/models/upscale_models",
"path_inpaint": "/stable-diffusion/models/inpaint",
"path_controlnet": "/stable-diffusion/models/controlnet",
"path_clip_vision": "/stable-diffusion/models/clip_vision",
"path_fooocus_expansion": "/stable-diffusion/models/prompt_expansion/fooocus_expansion",
"path_outputs": "/stable-diffusion/outputs"
}

View file

@ -0,0 +1,33 @@
#!/bin/bash
set -Eeuo pipefail
mkdir -vp /data/config/fooocus/wildcards
declare -A MOUNTS
MOUNTS["${ROOT}/outputs"]="/output/fooocus"
# ui specific mounts
MOUNTS["${ROOT}/models/checkpoints"]=/data/models/Stable-diffusion/
MOUNTS["${ROOT}/models/loras"]=/data/models/Lora/
MOUNTS["${ROOT}/models/embeddings"]=/data/models/embeddings/
MOUNTS["${ROOT}/models/vae_approx"]=/data/models/VAE/
MOUNTS["${ROOT}/models/upscale_models"]=/data/models/upscale_models/
MOUNTS["${ROOT}/wildcards"]=/data/config/fooocus/wildcards
for to_path in "${!MOUNTS[@]}"; do
set -Eeuo pipefail
from_path="${MOUNTS[${to_path}]}"
rm -rf "${to_path}"
mkdir -p "$(dirname "${to_path}")"
# ends with slash, make it!
if [[ "$from_path" == */ ]]; then
mkdir -vp "$from_path"
fi
ln -sT "${from_path}" "${to_path}"
echo Mounted $(basename "${from_path}")
done
exec "$@"