From 18fb90ea22aed7dc4b37465527d5ce37871a7bee Mon Sep 17 00:00:00 2001 From: Paul Lamb Date: Sat, 30 Dec 2023 20:34:47 -0800 Subject: [PATCH 01/92] First pass at getting Fooocus working --- docker-compose.yml | 8 ++++++ services/fooocus/Dockerfile | 48 ++++++++++++++++++++++++++++++++++ services/fooocus/config.txt | 12 +++++++++ services/fooocus/entrypoint.sh | 38 +++++++++++++++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 services/fooocus/Dockerfile create mode 100644 services/fooocus/config.txt create mode 100644 services/fooocus/entrypoint.sh diff --git a/docker-compose.yml b/docker-compose.yml index 93fba1d..a9a4147 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -71,3 +71,11 @@ services: deploy: {} environment: - CLI_ARGS=--cpu + + fooocus: &fooocus + <<: *base_service + profiles: ["fooocus"] + build: ./services/fooocus/ + image: sd-fooocus:3 + environment: + - CLI_ARGS= \ No newline at end of file diff --git a/services/fooocus/Dockerfile b/services/fooocus/Dockerfile new file mode 100644 index 0000000..5f6e120 --- /dev/null +++ b/services/fooocus/Dockerfile @@ -0,0 +1,48 @@ +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 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 + +ARG BRANCH=main SHA=8e62a72a63b30a3067d1a1bc3f8d226824bd9283 + +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 chmod u+x /docker/entrypoint.sh + +#ENV NVIDIA_VISIBLE_DEVICES=all +#ENV PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS="" +EXPOSE 7860 +ENTRYPOINT ["/docker/entrypoint.sh"] +CMD python -u entry_with_update.py --listen --port 7860 ${CLI_ARGS} diff --git a/services/fooocus/config.txt b/services/fooocus/config.txt new file mode 100644 index 0000000..ddced71 --- /dev/null +++ b/services/fooocus/config.txt @@ -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" +} \ No newline at end of file diff --git a/services/fooocus/entrypoint.sh b/services/fooocus/entrypoint.sh new file mode 100644 index 0000000..3cdc921 --- /dev/null +++ b/services/fooocus/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -Eeuo pipefail + +declare -A MOUNTS + +#mkdir -p ${CONFIG_DIR} ${ROOT}/configs/stable-diffusion/ + +# cache +#MOUNTS["/root/.cache"]=/data/.cache/ + +# this is really just a hack to avoid migrations +#rm -rf ${HF_HOME}/diffusers + +# ui specific +#MOUNTS["${ROOT}/models/codeformer"]=/data/models/Codeformer/ +#MOUNTS["${ROOT}/models/gfpgan/GFPGANv1.4.pth"]=/data/models/GFPGAN/GFPGANv1.4.pth +#MOUNTS["${ROOT}/models/gfpgan/weights"]=/data/models/GFPGAN/ +#MOUNTS["${ROOT}/models/realesrgan"]=/data/models/RealESRGAN/ +#MOUNTS["${ROOT}/models/ldm"]=/data/.cache/invoke/ldm/ + +# hacks + +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 "$@" From 77cfe4965ee3ccf40634f1be3486da640497c2ca Mon Sep 17 00:00:00 2001 From: Paul Lamb Date: Sat, 30 Dec 2023 22:20:58 -0800 Subject: [PATCH 02/92] Adding mount points to shared models --- services/fooocus/Dockerfile | 7 +++---- services/fooocus/entrypoint.sh | 22 +++++++--------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/services/fooocus/Dockerfile b/services/fooocus/Dockerfile index 5f6e120..7a1ff77 100644 --- a/services/fooocus/Dockerfile +++ b/services/fooocus/Dockerfile @@ -8,12 +8,12 @@ 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 +# add in required packages 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 +# set this to your target branch commit ARG BRANCH=main SHA=8e62a72a63b30a3067d1a1bc3f8d226824bd9283 ENV ROOT=/stable-diffusion @@ -39,10 +39,9 @@ RUN --mount=type=cache,target=/root/.cache/pip \ # add info COPY . /docker/ +RUN cp /docker/config.txt ${ROOT} RUN chmod u+x /docker/entrypoint.sh -#ENV NVIDIA_VISIBLE_DEVICES=all -#ENV PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS="" EXPOSE 7860 ENTRYPOINT ["/docker/entrypoint.sh"] CMD python -u entry_with_update.py --listen --port 7860 ${CLI_ARGS} diff --git a/services/fooocus/entrypoint.sh b/services/fooocus/entrypoint.sh index 3cdc921..ee1416e 100644 --- a/services/fooocus/entrypoint.sh +++ b/services/fooocus/entrypoint.sh @@ -4,22 +4,14 @@ set -Eeuo pipefail declare -A MOUNTS -#mkdir -p ${CONFIG_DIR} ${ROOT}/configs/stable-diffusion/ +MOUNTS["${ROOT}/outputs"]="/output/fooocus" -# cache -#MOUNTS["/root/.cache"]=/data/.cache/ - -# this is really just a hack to avoid migrations -#rm -rf ${HF_HOME}/diffusers - -# ui specific -#MOUNTS["${ROOT}/models/codeformer"]=/data/models/Codeformer/ -#MOUNTS["${ROOT}/models/gfpgan/GFPGANv1.4.pth"]=/data/models/GFPGAN/GFPGANv1.4.pth -#MOUNTS["${ROOT}/models/gfpgan/weights"]=/data/models/GFPGAN/ -#MOUNTS["${ROOT}/models/realesrgan"]=/data/models/RealESRGAN/ -#MOUNTS["${ROOT}/models/ldm"]=/data/.cache/invoke/ldm/ - -# hacks +# 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/ for to_path in "${!MOUNTS[@]}"; do set -Eeuo pipefail From 74813d56e7c3a1c517c9f21061de29668ce93bd4 Mon Sep 17 00:00:00 2001 From: Paul Lamb Date: Sun, 31 Dec 2023 14:32:26 -0800 Subject: [PATCH 03/92] Updated readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 95e10c3..a67bd9f 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,14 @@ This repository provides multiple UIs for you to play around with stable diffusi | -------------------------------------------------------------------------------- | | ![](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 Contributions are welcome! **Create a discussion first of what the problem is and what you want to contribute (before you implement anything)** From ff6e3d6fa87caa5cebaea89cefb3e8938c4cdaf8 Mon Sep 17 00:00:00 2001 From: Paul Lamb Date: Tue, 2 Jan 2024 00:17:55 -0800 Subject: [PATCH 04/92] Adding mount for wildcard functionality --- services/fooocus/entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/fooocus/entrypoint.sh b/services/fooocus/entrypoint.sh index ee1416e..cc0fa75 100644 --- a/services/fooocus/entrypoint.sh +++ b/services/fooocus/entrypoint.sh @@ -2,6 +2,8 @@ set -Eeuo pipefail +mkdir -vp /data/config/fooocus/wildcards + declare -A MOUNTS MOUNTS["${ROOT}/outputs"]="/output/fooocus" @@ -12,6 +14,7 @@ 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 cfc373d1d144f13adab8e095dd6e8f76c3cb951f Mon Sep 17 00:00:00 2001 From: Paul Lamb Date: Thu, 11 Apr 2024 16:44:12 -0700 Subject: [PATCH 05/92] Version bump, fooocus 2.3.1 --- services/fooocus/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/fooocus/Dockerfile b/services/fooocus/Dockerfile index 7a1ff77..1892f6b 100644 --- a/services/fooocus/Dockerfile +++ b/services/fooocus/Dockerfile @@ -14,7 +14,7 @@ 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=8e62a72a63b30a3067d1a1bc3f8d226824bd9283 +ARG BRANCH=main SHA=e2f9bcb11d06216d6800676c48d8d74d6fd77a4b ENV ROOT=/stable-diffusion RUN --mount=type=cache,target=/root/.cache/pip \ From e9fa4e641a0010c790b4a5ed94c44828bb1b6912 Mon Sep 17 00:00:00 2001 From: au70ma70n Date: Thu, 22 Aug 2024 18:44:43 -0500 Subject: [PATCH 06/92] add forge support --- services/forge/Dockerfile | 78 ++++++++++++++++++++++++++++++++ services/forge/clone.sh | 11 +++++ services/forge/config.py | 79 ++++++++++++++++++++++++++++++++ services/forge/entrypoint.sh | 85 +++++++++++++++++++++++++++++++++++ services/forge/tmp_dockerfile | 56 +++++++++++++++++++++++ 5 files changed, 309 insertions(+) create mode 100644 services/forge/Dockerfile create mode 100644 services/forge/clone.sh create mode 100644 services/forge/config.py create mode 100755 services/forge/entrypoint.sh create mode 100644 services/forge/tmp_dockerfile diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile new file mode 100644 index 0000000..65d0f1e --- /dev/null +++ b/services/forge/Dockerfile @@ -0,0 +1,78 @@ +FROM alpine/git:2.36.2 AS download + +COPY clone.sh /clone.sh + + +RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf \ + && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif + +RUN . /clone.sh CodeFormer https://github.com/sczhou/CodeFormer.git c5b4593074ba6214284d6acd5f1719b6c5d739af \ + && rm -rf assets inputs + +RUN . /clone.sh BLIP https://github.com/salesforce/BLIP.git 48211a1594f1321b00f14c9f7a5b4813144b2fb9 +RUN . /clone.sh k-diffusion https://github.com/crowsonkb/k-diffusion.git ab527a9a6d347f364e3d185ba6d714e22d80cb3c +RUN . /clone.sh clip-interrogator https://github.com/pharmapsychotic/clip-interrogator 2cf03aaf6e704197fd0dae7c7f96aa59cf1b11c9 +RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-models 45c443b316737a4ab6e40413d7794a7f5657c19f +RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git 6f7db241d2f8ba7457bac5ca9753331f0c266917 + + +FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime + +ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 + +RUN --mount=type=cache,target=/var/cache/apt \ + apt-get update && \ + # we need those + apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ + # extensions needs those + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential + + +WORKDIR / +RUN --mount=type=cache,target=/root/.cache/pip \ + git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git && \ + cd stable-diffusion-webui-forge && \ + sed -i '/torch/d' requirements_versions.txt && \ + pip install -r requirements_versions.txt + + +ENV ROOT=/stable-diffusion-webui-forge + +COPY --from=download /repositories/ ${ROOT}/repositories/ +RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt + +# Clone and copy huggingface_guess module +RUN git clone https://github.com/lllyasviel/huggingface_guess.git /tmp/huggingface_guess && \ + cp -r /tmp/huggingface_guess/huggingface_guess ${ROOT}/huggingface_guess + +# Ensure torchvision is correctly installed +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install torchvision==0.18.1 + + +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install pyngrok xformers==0.0.27 pytorch_lightning torchdiffeq torchsde \ + git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ + git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ + git+https://github.com/mlfoundations/open_clip.git@v2.20.0 +# there seems to be a memory leak (or maybe just memory not being freed fast enough) that is fixed by this version of malloc +# maybe move this up to the dependencies list. +RUN apt-get -y install libgoogle-perftools-dev && apt-get clean +ENV LD_PRELOAD=libtcmalloc.so + +COPY . /docker + +RUN \ + # mv ${ROOT}/style.css ${ROOT}/user.css && \ + # one of the ugliest hacks I ever wrote \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ + git config --global --add safe.directory '*' + +WORKDIR ${ROOT} +ENV NVIDIA_VISIBLE_DEVICES=all +ENV CLI_ARGS="" +EXPOSE 7860 +ENTRYPOINT ["/docker/entrypoint.sh"] +CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} diff --git a/services/forge/clone.sh b/services/forge/clone.sh new file mode 100644 index 0000000..2c37c41 --- /dev/null +++ b/services/forge/clone.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -Eeuox pipefail + +mkdir -p /repositories/"$1" +cd /repositories/"$1" +git init +git remote add origin "$2" +git fetch origin "$3" --depth=1 +git reset --hard "$3" +rm -rf .git \ No newline at end of file diff --git a/services/forge/config.py b/services/forge/config.py new file mode 100644 index 0000000..b06bf45 --- /dev/null +++ b/services/forge/config.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 + +"""Checks and sets default values for config.json before starting the container.""" + +import json +import re +import os.path +import sys + +DEFAULT_FILEPATH = '/data/config/forge/config.json' + +DEFAULT_OUTDIRS = { + "outdir_samples": "", + "outdir_txt2img_samples": "/output/txt2img", + "outdir_img2img_samples": "/output/img2img", + "outdir_extras_samples": "/output/extras", + "outdir_grids": "", + "outdir_txt2img_grids": "/output/txt2img-grids", + "outdir_img2img_grids": "/output/img2img-grids", + "outdir_save": "/output/saved", + "outdir_init_images": "/output/init-images", +} +RE_VALID_OUTDIR = re.compile(r"(^/output(/\.?[\w\-\_]+)+/?$)|(^\s?$)") + +DEFAULT_OTHER = { + "font": "DejaVuSans.ttf", +} + +def dict_to_json_file(target_file: str, data: dict): + """Write dictionary to specified json file""" + + with open(target_file, 'w') as f: + json.dump(data, f) + +def json_file_to_dict(config_file: str) -> dict|None: + """Load json file into a dictionary. Return None if file does not exist.""" + + if os.path.isfile(config_file): + with open(config_file, 'r') as f: + return json.load(f) + else: + return None + +def replace_if_invalid(value: str, replacement: str, pattern: str|re.Pattern[str]) -> str: + """Returns original value if valid, fallback value if invalid""" + + if re.match(pattern, value): + return value + else: + return replacement + +def check_and_replace_config(config_file: str, target_file: str = None): + """Checks given file for invalid values. Replaces those with fallback values (default: overwrites file).""" + + # Get current user config, or empty if file does not exists + data = json_file_to_dict(config_file) or {} + + # Check and fix output directories + for k, def_val in DEFAULT_OUTDIRS.items(): + if k not in data: + data[k] = def_val + else: + data[k] = replace_if_invalid(value=data[k], replacement=def_val, pattern=RE_VALID_OUTDIR) + + # Check and fix other default settings + for k, def_val in DEFAULT_OTHER.items(): + if k not in data: + data[k] = def_val + + # Write results to file + dict_to_json_file(target_file or config_file, data) + +if __name__ == '__main__': + if len(sys.argv) > 1: + check_and_replace_config(*sys.argv[1:]) + else: + check_and_replace_config(DEFAULT_FILEPATH) + + diff --git a/services/forge/entrypoint.sh b/services/forge/entrypoint.sh new file mode 100755 index 0000000..6532393 --- /dev/null +++ b/services/forge/entrypoint.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +set -Eeuo pipefail + +# TODO: move all mkdir -p ? +mkdir -p /data/config/forge/scripts/ +# mount scripts individually + +echo $ROOT +ls -lha $ROOT + +find "${ROOT}/scripts/" -maxdepth 1 -type l -delete +cp -vrfTs /data/config/forge/scripts/ "${ROOT}/scripts/" + +# Set up config file +python /docker/config.py /data/config/forge/config.json + +if [ ! -f /data/config/forge/ui-config.json ]; then + echo '{}' >/data/config/forge/ui-config.json +fi + +if [ ! -f /data/config/forge/styles.csv ]; then + touch /data/config/forge/styles.csv +fi + +# copy models from original models folder +mkdir -p /data/models/VAE-approx/ /data/models/karlo/ + +rsync -a --info=NAME ${ROOT}/models/VAE-approx/ /data/models/VAE-approx/ +rsync -a --info=NAME ${ROOT}/models/karlo/ /data/models/karlo/ + +declare -A MOUNTS + +MOUNTS["/root/.cache"]="/data/.cache" +MOUNTS["${ROOT}/models"]="/data/models" + +MOUNTS["${ROOT}/embeddings"]="/data/embeddings" +MOUNTS["${ROOT}/config.json"]="/data/config/forge/config.json" +MOUNTS["${ROOT}/ui-config.json"]="/data/config/forge/ui-config.json" +MOUNTS["${ROOT}/styles.csv"]="/data/config/forge/styles.csv" +MOUNTS["${ROOT}/extensions"]="/data/config/forge/extensions" +MOUNTS["${ROOT}/config_states"]="/data/config/forge/config_states" + +# extra hacks +MOUNTS["${ROOT}/repositories/CodeFormer/weights/facelib"]="/data/.cache" + +for to_path in "${!MOUNTS[@]}"; do + set -Eeuo pipefail + from_path="${MOUNTS[${to_path}]}" + rm -rf "${to_path}" + if [ ! -f "$from_path" ]; then + mkdir -vp "$from_path" + fi + mkdir -vp "$(dirname "${to_path}")" + ln -sT "${from_path}" "${to_path}" + echo Mounted $(basename "${from_path}") +done + +echo "Installing extension dependencies (if any)" + +# because we build our container as root: +chown -R root ~/.cache/ +chmod 766 ~/.cache/ + +shopt -s nullglob +# For install.py, please refer to https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Developing-extensions#installpy +list=(./extensions/*/install.py) +for installscript in "${list[@]}"; do + EXTNAME=$(echo $installscript | cut -d '/' -f 3) + # Skip installing dependencies if extension is disabled in config + if $(jq -e ".disabled_extensions|any(. == \"$EXTNAME\")" config.json); then + echo "Skipping disabled extension ($EXTNAME)" + continue + fi + PYTHONPATH=${ROOT} python "$installscript" +done + +if [ -f "/data/config/forge/startup.sh" ]; then + pushd ${ROOT} + echo "Running startup script" + . /data/config/forge/startup.sh + popd +fi + +exec "$@" diff --git a/services/forge/tmp_dockerfile b/services/forge/tmp_dockerfile new file mode 100644 index 0000000..301d025 --- /dev/null +++ b/services/forge/tmp_dockerfile @@ -0,0 +1,56 @@ +FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime + +ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 + +RUN --mount=type=cache,target=/var/cache/apt \ + apt-get update && \ + # we need those + apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ + # extensions needs those + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential + +WORKDIR / +RUN --mount=type=cache,target=/root/.cache/pip \ + git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git && \ + cd stable-diffusion-webui-forge && \ + pip install -r requirements_versions.txt + +ENV ROOT=/stable-diffusion-webui-forge + +COPY --from=download /repositories/ ${ROOT}/repositories/ +RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt + +# Clone and copy huggingface_guess module +RUN git clone https://github.com/lllyasviel/huggingface_guess.git /tmp/huggingface_guess && \ + cp -r /tmp/huggingface_guess/huggingface_guess ${ROOT}/huggingface_guess + +# Ensure torchvision is correctly installed +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install --upgrade torchvision + +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install pyngrok xformers==0.0.23.post1 \ + git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ + git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ + git+https://github.com/mlfoundations/open_clip.git@v2.20.0 + +# there seems to be a memory leak (or maybe just memory not being freed fast enough) that is fixed by this version of malloc +# maybe move this up to the dependencies list. +RUN apt-get -y install libgoogle-perftools-dev && apt-get clean +ENV LD_PRELOAD=libtcmalloc.so + +COPY . /docker + +RUN \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ + git config --global --add safe.directory '*' + +WORKDIR ${ROOT} +ENV PYTHONPATH=${ROOT}:${PYTHONPATH} +ENV NVIDIA_VISIBLE_DEVICES=all +ENV CLI_ARGS="" +EXPOSE 7860 +ENTRYPOINT ["/docker/entrypoint.sh"] +CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} \ No newline at end of file From f859c3b2212962373de1757b49cb1e2f5af0104b Mon Sep 17 00:00:00 2001 From: au70ma70n Date: Fri, 23 Aug 2024 11:00:54 -0500 Subject: [PATCH 07/92] Fix forge in compose --- docker-compose.yml | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 970b612..e87ddef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,4 @@ +version: '3.9' x-base_service: &base_service ports: - "${WEBUI_PORT:-7860}:7860" @@ -13,40 +14,56 @@ x-base_service: &base_service - driver: nvidia device_ids: ['0'] capabilities: [compute, utility] - name: webui-docker - services: download: build: ./services/download/ profiles: ["download"] volumes: - *v1 - auto: &automatic <<: *base_service profiles: ["auto"] build: ./services/AUTOMATIC1111 - image: sd-auto:78 + image: sd-auto:72 environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api + forge: &forge + <<: *base_service + profiles: ["forge"] + build: ./services/forge + image: sd-forge-fgcustom:72 + environment: + - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream + auto-cpu: <<: *automatic profiles: ["auto-cpu"] deploy: {} environment: - CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api - + invoke: &invoke + <<: *base_service + profiles: ["invoke"] + build: ./services/invoke/ + image: sd-invoke:30 + environment: + - PRELOAD=true + - CLI_ARGS=--xformers + # invoke-cpu: + # <<: *invoke + # profiles: ["invoke-cpu"] + # environment: + # - PRELOAD=true + # - CLI_ARGS=--always_use_cpu comfy: &comfy <<: *base_service profiles: ["comfy"] build: ./services/comfy/ - image: sd-comfy:7 + image: sd-comfy:6 environment: - CLI_ARGS= - - comfy-cpu: <<: *comfy profiles: ["comfy-cpu"] From 3ed0a6acf7bfa19ece10c3037def1ea83fd0cbed Mon Sep 17 00:00:00 2001 From: Simon McNair <101189766+simonmcnair@users.noreply.github.com> Date: Thu, 16 Jan 2025 20:28:44 +0000 Subject: [PATCH 08/92] updates --- docker-compose.yml | 1 - services/AUTOMATIC1111/Dockerfile | 4 ++-- services/AUTOMATIC1111/clone.sh | 2 +- services/forge/Dockerfile | 5 +---- services/forge/config.py | 1 - 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e87ddef..f49d73d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.9' x-base_service: &base_service ports: - "${WEBUI_PORT:-7860}:7860" diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index d595784..ff0454f 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine/git:2.36.2 as download +FROM alpine/git:2.36.2 AS download COPY clone.sh /clone.sh @@ -30,7 +30,7 @@ WORKDIR / RUN --mount=type=cache,target=/root/.cache/pip \ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && \ cd stable-diffusion-webui && \ - git reset --hard v1.9.4 && \ + git reset --hard v1.10.0 && \ pip install -r requirements_versions.txt diff --git a/services/AUTOMATIC1111/clone.sh b/services/AUTOMATIC1111/clone.sh index cfdf0a2..2c37c41 100644 --- a/services/AUTOMATIC1111/clone.sh +++ b/services/AUTOMATIC1111/clone.sh @@ -8,4 +8,4 @@ git init git remote add origin "$2" git fetch origin "$3" --depth=1 git reset --hard "$3" -rm -rf .git +rm -rf .git \ No newline at end of file diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index 65d0f1e..d18f430 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -2,7 +2,6 @@ FROM alpine/git:2.36.2 AS download COPY clone.sh /clone.sh - RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf \ && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif @@ -35,7 +34,6 @@ RUN --mount=type=cache,target=/root/.cache/pip \ sed -i '/torch/d' requirements_versions.txt && \ pip install -r requirements_versions.txt - ENV ROOT=/stable-diffusion-webui-forge COPY --from=download /repositories/ ${ROOT}/repositories/ @@ -51,7 +49,6 @@ RUN git clone https://github.com/lllyasviel/huggingface_guess.git /tmp/huggingfa RUN --mount=type=cache,target=/root/.cache/pip \ pip install torchvision==0.18.1 - RUN --mount=type=cache,target=/root/.cache/pip \ pip install pyngrok xformers==0.0.27 pytorch_lightning torchdiffeq torchsde \ git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ @@ -75,4 +72,4 @@ ENV NVIDIA_VISIBLE_DEVICES=all ENV CLI_ARGS="" EXPOSE 7860 ENTRYPOINT ["/docker/entrypoint.sh"] -CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} +CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} \ No newline at end of file diff --git a/services/forge/config.py b/services/forge/config.py index b06bf45..7ab28d7 100644 --- a/services/forge/config.py +++ b/services/forge/config.py @@ -76,4 +76,3 @@ if __name__ == '__main__': else: check_and_replace_config(DEFAULT_FILEPATH) - From 276f417a7e4894f29e691b57a0be686bbc861ee5 Mon Sep 17 00:00:00 2001 From: Simon McNair <101189766+simonmcnair@users.noreply.github.com> Date: Thu, 16 Jan 2025 20:46:19 +0000 Subject: [PATCH 09/92] updates --- docker-compose.yml | 4 ++-- services/AUTOMATIC1111/Dockerfile | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f49d73d..0fba59e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ services: <<: *base_service profiles: ["auto"] build: ./services/AUTOMATIC1111 - image: sd-auto:72 + image: sd-auto:80 environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api @@ -32,7 +32,7 @@ services: <<: *base_service profiles: ["forge"] build: ./services/forge - image: sd-forge-fgcustom:72 + image: sd-forge:80 environment: - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index ff0454f..047bc95 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -33,6 +33,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \ git reset --hard v1.10.0 && \ pip install -r requirements_versions.txt +RUN pip install --upgrade typing-extensions ENV ROOT=/stable-diffusion-webui From 3367764793ec4c15c60f9833551da046ab696a1e Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:14:27 +0000 Subject: [PATCH 10/92] Update README.md updated readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 46b5630..14e8eeb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +I have forked this as abdbarho hasn't been around for a while. I'm not great with git, Linux , docker or stable diffusion but I manage to get along a bit. Slowly. with more commits than it takes. + +I am happy to look at PR's as and when. Also happy to pass this back, as and whe, and if, they return. + + # Stable Diffusion WebUI Docker Run Stable Diffusion on your machine with a nice UI without any hassle! From 015f531c4c76cc343b0e3473b0829076b95e05a7 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:16:13 +0000 Subject: [PATCH 11/92] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 14e8eeb..01872d9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -I have forked this as abdbarho hasn't been around for a while. I'm not great with git, Linux , docker or stable diffusion but I manage to get along a bit. Slowly. with more commits than it takes. +I have forked this as AbdBarho hasn't been around for a while. I'm not great with git, Linux , docker or stable diffusion but I manage to get along a bit. Slowly. with more commits than it takes. I am happy to look at PR's as and when. Also happy to pass this back, as and whe, and if, they return. From 20b593f840d17c9e512e6984d75579df489a8783 Mon Sep 17 00:00:00 2001 From: Simon McNair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:49:41 +0000 Subject: [PATCH 12/92] huggingface_guess was in incorrect location --- services/forge/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index d18f430..807f3ac 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -13,6 +13,7 @@ RUN . /clone.sh k-diffusion https://github.com/crowsonkb/k-diffusion.git ab527a9 RUN . /clone.sh clip-interrogator https://github.com/pharmapsychotic/clip-interrogator 2cf03aaf6e704197fd0dae7c7f96aa59cf1b11c9 RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-models 45c443b316737a4ab6e40413d7794a7f5657c19f RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git 6f7db241d2f8ba7457bac5ca9753331f0c266917 +RUN . /clone.sh huggingface_guess https://github.com/lllyasviel/huggingface_guess.git 70942022b6bcd17d941c1b4172804175758618e2 FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime @@ -42,8 +43,8 @@ RUN --mount=type=cache,target=/root/.cache/pip \ pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt # Clone and copy huggingface_guess module -RUN git clone https://github.com/lllyasviel/huggingface_guess.git /tmp/huggingface_guess && \ - cp -r /tmp/huggingface_guess/huggingface_guess ${ROOT}/huggingface_guess +#RUN git clone https://github.com/lllyasviel/huggingface_guess.git /tmp/huggingface_guess && \ +# cp -r /tmp/huggingface_guess/huggingface_guess ${ROOT}/huggingface_guess # Ensure torchvision is correctly installed RUN --mount=type=cache,target=/root/.cache/pip \ From ae30d6b0af580a0775310c93db4e2672c3c2bd72 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 20 Jan 2025 19:02:33 +0000 Subject: [PATCH 13/92] Update Dockerfile pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime --- services/AUTOMATIC1111/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 047bc95..2d0559a 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -14,7 +14,8 @@ RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-mod RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets 6f7db241d2f8ba7457bac5ca9753331f0c266917 -FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime +#FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime +FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 From 9e86d3ea7078ac238eb9c10610f12c20cee9ee69 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 20 Jan 2025 19:37:08 +0000 Subject: [PATCH 14/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 2d0559a..e589afb 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -57,7 +57,7 @@ COPY . /docker RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ # one of the ugliest hacks I ever wrote \ - sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ + #sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ git config --global --add safe.directory '*' WORKDIR ${ROOT} From 56127109197fee55809940fa6378f9c0a8b19b26 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 20 Jan 2025 19:41:41 +0000 Subject: [PATCH 15/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index e589afb..b3e6d7e 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -14,8 +14,8 @@ RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-mod RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets 6f7db241d2f8ba7457bac5ca9753331f0c266917 -#FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime -FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime +FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime +#FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 @@ -57,7 +57,7 @@ COPY . /docker RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ # one of the ugliest hacks I ever wrote \ - #sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ git config --global --add safe.directory '*' WORKDIR ${ROOT} From 8619e741270c621d5ebd142d201142492efb692e Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 20 Jan 2025 19:56:30 +0000 Subject: [PATCH 16/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index b3e6d7e..026bd54 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -14,8 +14,8 @@ RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-mod RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets 6f7db241d2f8ba7457bac5ca9753331f0c266917 -FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime -#FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime +#FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime +FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 @@ -57,7 +57,8 @@ COPY . /docker RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ # one of the ugliest hacks I ever wrote \ - sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ + # updated from 3.10.to 3.11 + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.11/site-packages/gradio/routes.py && \ git config --global --add safe.directory '*' WORKDIR ${ROOT} From bf55e214ac64bcd75f302602507cf9a068341e03 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:36:56 +0000 Subject: [PATCH 17/92] Update entrypoint.sh --- services/AUTOMATIC1111/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/AUTOMATIC1111/entrypoint.sh b/services/AUTOMATIC1111/entrypoint.sh index 35023af..3b4d92b 100755 --- a/services/AUTOMATIC1111/entrypoint.sh +++ b/services/AUTOMATIC1111/entrypoint.sh @@ -26,8 +26,8 @@ fi # copy models from original models folder mkdir -p /data/models/VAE-approx/ /data/models/karlo/ -rsync -a --info=NAME ${ROOT}/models/VAE-approx/ /data/models/VAE-approx/ -rsync -a --info=NAME ${ROOT}/models/karlo/ /data/models/karlo/ +rsync --info=NAME ${ROOT}/models/VAE-approx/ /data/models/VAE-approx/ +rsync --info=NAME ${ROOT}/models/karlo/ /data/models/karlo/ declare -A MOUNTS From 1fa117f333de996ca203ed64ec9cbaebaa849412 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Feb 2025 20:39:04 +0000 Subject: [PATCH 18/92] Update Dockerfile 1.10.1 --- services/AUTOMATIC1111/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 026bd54..54d41ba 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -31,7 +31,7 @@ WORKDIR / RUN --mount=type=cache,target=/root/.cache/pip \ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && \ cd stable-diffusion-webui && \ - git reset --hard v1.10.0 && \ + git reset --hard v1.10.1 && \ pip install -r requirements_versions.txt RUN pip install --upgrade typing-extensions From cc08ed6a109881f95b41ad6adc6f5a7b7a351969 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 11:23:04 +0000 Subject: [PATCH 19/92] Update Dockerfile remove root user requirement --- services/AUTOMATIC1111/Dockerfile | 45 +++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 54d41ba..a33fb1d 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -24,8 +24,45 @@ RUN --mount=type=cache,target=/var/cache/apt \ # we need those apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ # extensions needs those - ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential \ + apt-get clean +ARG PUID=0 +ARG PGID=0 +ARG USER_HOME=/root +# set build args as container environment variables for entrypoint reference +ENV PUID=$PUID +ENV PGID=$PGID +ENV USER_HOME=$USER_HOME + +# if user home does not exist, create it +RUN mkdir -p "$USER_HOME" + +# home already exists, chown it +RUN chown -R "${PUID}:${PGID}" "$USER_HOME" + +# Only groupadd if we're non root +RUN if [ "$PGID" -ne "0" ]; then \ + echo non root group detected; \ + groupadd \ + --gid "$PGID" \ + stablediffusion ;\ + else \ + echo "root group detected" ; \ + fi + +# Only useradd if we're non root +RUN if [ "$PUID" -ne "0" ]; then \ + echo non root user detected; \ + useradd \ + --gid="$PGID" \ + --no-user-group \ + -M \ + --home "$USER_HOME" \ + stablediffusion ; \ + else \ + echo "root group detected" ; \ + fi WORKDIR / RUN --mount=type=cache,target=/root/.cache/pip \ @@ -36,9 +73,13 @@ RUN --mount=type=cache,target=/root/.cache/pip \ RUN pip install --upgrade typing-extensions +RUN chown -R "$PUID:$PGID" /stable-diffusion-webui + +# drop permissions (if build targets non root) +USER $PUID:$PGID ENV ROOT=/stable-diffusion-webui -COPY --from=download /repositories/ ${ROOT}/repositories/ +COPY --from=download --chown=${PUID}:${PGID} /repositories/ ${ROOT}/repositories/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate RUN --mount=type=cache,target=/root/.cache/pip \ From b52f5c6f4bd6248c3a921dc31a4e3d0e13a4393a Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 11:26:04 +0000 Subject: [PATCH 20/92] Update entrypoint.sh remove root user --- services/AUTOMATIC1111/entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/AUTOMATIC1111/entrypoint.sh b/services/AUTOMATIC1111/entrypoint.sh index 3b4d92b..e5b5bcb 100755 --- a/services/AUTOMATIC1111/entrypoint.sh +++ b/services/AUTOMATIC1111/entrypoint.sh @@ -31,7 +31,8 @@ rsync --info=NAME ${ROOT}/models/karlo/ /data/models/karlo/ declare -A MOUNTS -MOUNTS["/root/.cache"]="/data/.cache" +#MOUNTS["/root/.cache"]="/data/.cache" +MOUNTS["${USER_HOME}/.cache"]="/data/.cache" MOUNTS["${ROOT}/models"]="/data/models" MOUNTS["${ROOT}/embeddings"]="/data/embeddings" @@ -58,8 +59,7 @@ done echo "Installing extension dependencies (if any)" -# because we build our container as root: -chown -R root ~/.cache/ +chown -R $PUID:$PGID ~/.cache/ chmod 766 ~/.cache/ shopt -s nullglob From 66a1490c87bd95eba3c1e6012accec20cb953362 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 11:27:21 +0000 Subject: [PATCH 21/92] Update entrypoint.sh make output belong to user too --- services/AUTOMATIC1111/entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/AUTOMATIC1111/entrypoint.sh b/services/AUTOMATIC1111/entrypoint.sh index e5b5bcb..4313803 100755 --- a/services/AUTOMATIC1111/entrypoint.sh +++ b/services/AUTOMATIC1111/entrypoint.sh @@ -62,6 +62,9 @@ echo "Installing extension dependencies (if any)" chown -R $PUID:$PGID ~/.cache/ chmod 766 ~/.cache/ +chown -R $PUID:$PGID /output +chmod 766 /output + shopt -s nullglob # For install.py, please refer to https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Developing-extensions#installpy list=(./extensions/*/install.py) From b642d3a7f25acaf1c12d2721cdca61a3251f11ee Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 11:34:35 +0000 Subject: [PATCH 22/92] Update Dockerfile fix --- services/AUTOMATIC1111/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index a33fb1d..3f2c893 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -24,7 +24,7 @@ RUN --mount=type=cache,target=/var/cache/apt \ # we need those apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ # extensions needs those - ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential \ + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential && \ apt-get clean ARG PUID=0 From 18709fa51227d0394aae30a55b2c7253568cc44e Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 11:55:04 +0000 Subject: [PATCH 23/92] Update docker-compose.yml --- docker-compose.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 995427e..30db3ec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,6 +20,7 @@ services: profiles: ["download"] volumes: - *v1 + auto: &automatic <<: *base_service profiles: ["auto"] @@ -27,6 +28,8 @@ services: image: sd-auto:80 environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api + - PUID=1000 + - PGID=1000 forge: &forge <<: *base_service @@ -35,6 +38,8 @@ services: image: sd-forge:80 environment: - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream + - PUID=1000 + - PGID=1000 auto-cpu: <<: *automatic @@ -42,6 +47,9 @@ services: deploy: {} environment: - CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api + - PUID=1000 + - PGID=1000 + invoke: &invoke <<: *base_service profiles: ["invoke"] @@ -50,12 +58,16 @@ services: environment: - PRELOAD=true - CLI_ARGS=--xformers + - PUID=1000 + - PGID=1000 + # invoke-cpu: # <<: *invoke # profiles: ["invoke-cpu"] # environment: # - PRELOAD=true # - CLI_ARGS=--always_use_cpu + comfy: &comfy <<: *base_service profiles: ["comfy"] @@ -63,12 +75,17 @@ services: image: sd-comfy:6 environment: - CLI_ARGS= + - PUID=1000 + - PGID=1000 + comfy-cpu: <<: *comfy profiles: ["comfy-cpu"] deploy: {} environment: - CLI_ARGS=--cpu + - PUID=1000 + - PGID=1000 fooocus: &fooocus <<: *base_service @@ -76,4 +93,6 @@ services: build: ./services/fooocus/ image: sd-fooocus:3 environment: - - CLI_ARGS= \ No newline at end of file + - CLI_ARGS= + - PUID=1000 + - PGID=1000 From fe5caa90661dc3d17a553c2134093c5f26812290 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 12:06:54 +0000 Subject: [PATCH 24/92] Discard changes to docker-compose.yml --- docker-compose.yml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 30db3ec..995427e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,7 +20,6 @@ services: profiles: ["download"] volumes: - *v1 - auto: &automatic <<: *base_service profiles: ["auto"] @@ -28,8 +27,6 @@ services: image: sd-auto:80 environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api - - PUID=1000 - - PGID=1000 forge: &forge <<: *base_service @@ -38,8 +35,6 @@ services: image: sd-forge:80 environment: - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream - - PUID=1000 - - PGID=1000 auto-cpu: <<: *automatic @@ -47,9 +42,6 @@ services: deploy: {} environment: - CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api - - PUID=1000 - - PGID=1000 - invoke: &invoke <<: *base_service profiles: ["invoke"] @@ -58,16 +50,12 @@ services: environment: - PRELOAD=true - CLI_ARGS=--xformers - - PUID=1000 - - PGID=1000 - # invoke-cpu: # <<: *invoke # profiles: ["invoke-cpu"] # environment: # - PRELOAD=true # - CLI_ARGS=--always_use_cpu - comfy: &comfy <<: *base_service profiles: ["comfy"] @@ -75,17 +63,12 @@ services: image: sd-comfy:6 environment: - CLI_ARGS= - - PUID=1000 - - PGID=1000 - comfy-cpu: <<: *comfy profiles: ["comfy-cpu"] deploy: {} environment: - CLI_ARGS=--cpu - - PUID=1000 - - PGID=1000 fooocus: &fooocus <<: *base_service @@ -93,6 +76,4 @@ services: build: ./services/fooocus/ image: sd-fooocus:3 environment: - - CLI_ARGS= - - PUID=1000 - - PGID=1000 + - CLI_ARGS= \ No newline at end of file From 268892366134d0850752d116c5eeca1b1846209b Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 12:21:46 +0000 Subject: [PATCH 25/92] Update Dockerfile add non root --- services/forge/Dockerfile | 49 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index 807f3ac..79f4497 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -25,7 +25,45 @@ RUN --mount=type=cache,target=/var/cache/apt \ # we need those apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ # extensions needs those - ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential && \ + apt-get clean + +ARG PUID=0 +ARG PGID=0 +ARG USER_HOME=/root +# set build args as container environment variables for entrypoint reference +ENV PUID=$PUID +ENV PGID=$PGID +ENV USER_HOME=$USER_HOME + +# if user home does not exist, create it +RUN mkdir -p "$USER_HOME" + +# home already exists, chown it +RUN chown -R "${PUID}:${PGID}" "$USER_HOME" + +# Only groupadd if we're non root +RUN if [ "$PGID" -ne "0" ]; then \ + echo non root group detected; \ + groupadd \ + --gid "$PGID" \ + stablediffusion ;\ + else \ + echo "root group detected" ; \ + fi + +# Only useradd if we're non root +RUN if [ "$PUID" -ne "0" ]; then \ + echo non root user detected; \ + useradd \ + --gid="$PGID" \ + --no-user-group \ + -M \ + --home "$USER_HOME" \ + stablediffusion ; \ + else \ + echo "root group detected" ; \ + fi WORKDIR / @@ -35,9 +73,14 @@ RUN --mount=type=cache,target=/root/.cache/pip \ sed -i '/torch/d' requirements_versions.txt && \ pip install -r requirements_versions.txt +RUN chown -R "$PUID:$PGID" /stable-diffusion-webui + +# drop permissions (if build targets non root) +USER $PUID:$PGID + ENV ROOT=/stable-diffusion-webui-forge -COPY --from=download /repositories/ ${ROOT}/repositories/ +COPY --from=download --chown=${PUID}:${PGID} /repositories/ ${ROOT}/repositories/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate RUN --mount=type=cache,target=/root/.cache/pip \ pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt @@ -73,4 +116,4 @@ ENV NVIDIA_VISIBLE_DEVICES=all ENV CLI_ARGS="" EXPOSE 7860 ENTRYPOINT ["/docker/entrypoint.sh"] -CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} \ No newline at end of file +CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} From c1c52f5e538d238e894091774120c06f8e4a9484 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 12:23:41 +0000 Subject: [PATCH 26/92] Update entrypoint.sh non root --- services/forge/entrypoint.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/forge/entrypoint.sh b/services/forge/entrypoint.sh index 6532393..110ed98 100755 --- a/services/forge/entrypoint.sh +++ b/services/forge/entrypoint.sh @@ -31,7 +31,7 @@ rsync -a --info=NAME ${ROOT}/models/karlo/ /data/models/karlo/ declare -A MOUNTS -MOUNTS["/root/.cache"]="/data/.cache" +MOUNTS["${USER_HOME}/.cache"]="/data/.cache" MOUNTS["${ROOT}/models"]="/data/models" MOUNTS["${ROOT}/embeddings"]="/data/embeddings" @@ -56,11 +56,12 @@ for to_path in "${!MOUNTS[@]}"; do echo Mounted $(basename "${from_path}") done -echo "Installing extension dependencies (if any)" - -# because we build our container as root: -chown -R root ~/.cache/ +chown -R $PUID:$PGID ~/.cache/ chmod 766 ~/.cache/ +chown -R $PUID:$PGID /output +chmod 766 /output + +echo "Installing extension dependencies (if any)" shopt -s nullglob # For install.py, please refer to https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Developing-extensions#installpy From 321046928469f72d6bd73140fd70579ab2287706 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 12:28:52 +0000 Subject: [PATCH 27/92] Update Dockerfile oops --- services/forge/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index 79f4497..dd69f92 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -73,7 +73,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \ sed -i '/torch/d' requirements_versions.txt && \ pip install -r requirements_versions.txt -RUN chown -R "$PUID:$PGID" /stable-diffusion-webui +RUN chown -R "$PUID:$PGID" /stable-diffusion-webui-forge # drop permissions (if build targets non root) USER $PUID:$PGID From dd08166d5e94afef5a32062977e18922513a7dcd Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 13:52:58 +0000 Subject: [PATCH 28/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 3f2c893..90d3cd1 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -24,7 +24,7 @@ RUN --mount=type=cache,target=/var/cache/apt \ # we need those apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ # extensions needs those - ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential && \ + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential libgoogle-perftools-dev && \ apt-get clean ARG PUID=0 From dd4791cf0aef1ed28bf3e40afeb9336018e52c04 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 13:53:18 +0000 Subject: [PATCH 29/92] Update Dockerfile --- services/forge/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index dd69f92..5c32b72 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -25,7 +25,7 @@ RUN --mount=type=cache,target=/var/cache/apt \ # we need those apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ # extensions needs those - ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential && \ + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential libgoogle-perftools-dev && \ apt-get clean ARG PUID=0 From b336cbc064db31d169ae790e16ee48487c86a7a0 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:20:43 +0000 Subject: [PATCH 30/92] Update Dockerfile no root changes --- services/comfy/Dockerfile | 44 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index 2de504d..47b24c9 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -2,10 +2,50 @@ FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime 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 libgoogle-perftools-dev && apt-get clean + +ARG PUID=0 +ARG PGID=0 +ARG USER_HOME=/root +# set build args as container environment variables for entrypoint reference +ENV PUID=$PUID +ENV PGID=$PGID +ENV USER_HOME=$USER_HOME + +# if user home does not exist, create it +RUN mkdir -p "$USER_HOME" + +# home already exists, chown it +RUN chown -R "${PUID}:${PGID}" "$USER_HOME" + +# Only groupadd if we're non root +RUN if [ "$PGID" -ne "0" ]; then \ + echo non root group detected; \ + groupadd \ + --gid "$PGID" \ + stablediffusion ;\ + else \ + echo "root group detected" ; \ + fi + +# Only useradd if we're non root +RUN if [ "$PUID" -ne "0" ]; then \ + echo non root user detected; \ + useradd \ + --gid="$PGID" \ + --no-user-group \ + -M \ + --home "$USER_HOME" \ + stablediffusion ; \ + else \ + echo "root group detected" ; \ + fi + +RUN chown -R "$PUID:$PGID" /stable-diffusion +USER $PUID:$PGID ENV ROOT=/stable-diffusion -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target="$USER_HOME"/.cache/pip \ git clone https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \ cd ${ROOT} && \ git checkout master && \ From 40e1e818beba5edcf8452f972a8a865ff5876245 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:22:09 +0000 Subject: [PATCH 31/92] Update entrypoint.sh no_root --- services/comfy/entrypoint.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/comfy/entrypoint.sh b/services/comfy/entrypoint.sh index b4299a7..b94ac10 100755 --- a/services/comfy/entrypoint.sh +++ b/services/comfy/entrypoint.sh @@ -6,7 +6,7 @@ mkdir -vp /data/config/comfy/custom_nodes declare -A MOUNTS -MOUNTS["/root/.cache"]="/data/.cache" +MOUNTS["${USER_HOME}/.cache"]="/data/.cache" MOUNTS["${ROOT}/input"]="/data/config/comfy/input" MOUNTS["${ROOT}/output"]="/output/comfy" @@ -28,4 +28,9 @@ if [ -f "/data/config/comfy/startup.sh" ]; then popd fi +chown -R root ~/.cache/ +chmod 766 ~/.cache/ +chown -R $PUID:$PGID ~/.cache/ +chmod 776 ~/.cache/ + exec "$@" From 8c3649469b5f5000be49b0a3774f6d5eb4c8efaf Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:27:18 +0000 Subject: [PATCH 32/92] Update Dockerfile no_root --- services/fooocus/Dockerfile | 52 ++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/services/fooocus/Dockerfile b/services/fooocus/Dockerfile index 1892f6b..35ad916 100644 --- a/services/fooocus/Dockerfile +++ b/services/fooocus/Dockerfile @@ -6,17 +6,57 @@ 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 +RUN apt-get update && apt-get install -y git libglib2.0-0 libgl1-mesa-glx python-dev libgoogle-perftools-dev && apt-get clean + +ARG PUID=0 +ARG PGID=0 +ARG USER_HOME=/root +# set build args as container environment variables for entrypoint reference +ENV PUID=$PUID +ENV PGID=$PGID +ENV USER_HOME=$USER_HOME + +# if user home does not exist, create it +RUN mkdir -p "$USER_HOME" + +# home already exists, chown it +RUN chown -R "${PUID}:${PGID}" "$USER_HOME" + +# Only groupadd if we're non root +RUN if [ "$PGID" -ne "0" ]; then \ + echo non root group detected; \ + groupadd \ + --gid "$PGID" \ + stablediffusion ;\ + else \ + echo "root group detected" ; \ + fi + +# Only useradd if we're non root +RUN if [ "$PUID" -ne "0" ]; then \ + echo non root user detected; \ + useradd \ + --gid="$PGID" \ + --no-user-group \ + -M \ + --home "$USER_HOME" \ + stablediffusion ; \ + else \ + echo "root group detected" ; \ + fi + -# 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=e2f9bcb11d06216d6800676c48d8d74d6fd77a4b ENV ROOT=/stable-diffusion + +RUN chown -R "$PUID:$PGID" /stable-diffusion-webui + +# drop permissions (if build targets non root) +USER $PUID:$PGID + RUN --mount=type=cache,target=/root/.cache/pip \ git clone https://github.com/lllyasviel/Fooocus.git ${ROOT} && \ cd ${ROOT} && \ @@ -38,7 +78,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \ pip install -r requirements_versions.txt # add info -COPY . /docker/ +COPY --chown=$PUID:$PGID . /docker RUN cp /docker/config.txt ${ROOT} RUN chmod u+x /docker/entrypoint.sh From d5af00119af1250890d231597e4e7e71bab4ae3a Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:29:31 +0000 Subject: [PATCH 33/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 90d3cd1..b1b9f84 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -65,7 +65,7 @@ RUN if [ "$PUID" -ne "0" ]; then \ fi WORKDIR / -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && \ cd stable-diffusion-webui && \ git reset --hard v1.10.1 && \ @@ -82,7 +82,7 @@ ENV ROOT=/stable-diffusion-webui COPY --from=download --chown=${PUID}:${PGID} /repositories/ ${ROOT}/repositories/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ pip install pyngrok xformers==0.0.26.post1 \ git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ @@ -90,11 +90,10 @@ RUN --mount=type=cache,target=/root/.cache/pip \ # there seems to be a memory leak (or maybe just memory not being freed fast enough) that is fixed by this version of malloc # maybe move this up to the dependencies list. -RUN apt-get -y install libgoogle-perftools-dev && apt-get clean ENV LD_PRELOAD=libtcmalloc.so COPY . /docker - +COPY --chown=$PUID:$PGID . /docker RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ # one of the ugliest hacks I ever wrote \ From 1e34142322003ab0e4f443f9a169aae0346ba77c Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:34:20 +0000 Subject: [PATCH 34/92] Update Dockerfile no root --- services/forge/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index 5c32b72..a0c676d 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -67,7 +67,7 @@ RUN if [ "$PUID" -ne "0" ]; then \ WORKDIR / -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git && \ cd stable-diffusion-webui-forge && \ sed -i '/torch/d' requirements_versions.txt && \ @@ -90,17 +90,17 @@ RUN --mount=type=cache,target=/root/.cache/pip \ # cp -r /tmp/huggingface_guess/huggingface_guess ${ROOT}/huggingface_guess # Ensure torchvision is correctly installed -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ pip install torchvision==0.18.1 -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ pip install pyngrok xformers==0.0.27 pytorch_lightning torchdiffeq torchsde \ git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ git+https://github.com/mlfoundations/open_clip.git@v2.20.0 # there seems to be a memory leak (or maybe just memory not being freed fast enough) that is fixed by this version of malloc # maybe move this up to the dependencies list. -RUN apt-get -y install libgoogle-perftools-dev && apt-get clean + ENV LD_PRELOAD=libtcmalloc.so COPY . /docker From d2ec770e8b459ecb62acac55610aea942bb98cc4 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:36:59 +0000 Subject: [PATCH 35/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index b1b9f84..8f6b91d 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -92,7 +92,6 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ # maybe move this up to the dependencies list. ENV LD_PRELOAD=libtcmalloc.so -COPY . /docker COPY --chown=$PUID:$PGID . /docker RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ From 7e35f1384675e1b254c979398341b3236b377a0d Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:37:41 +0000 Subject: [PATCH 36/92] Update Dockerfile --- services/comfy/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index 47b24c9..ec63220 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -53,7 +53,7 @@ RUN --mount=type=cache,target="$USER_HOME"/.cache/pip \ pip install -r requirements.txt WORKDIR ${ROOT} -COPY . /docker/ +COPY --chown=$PUID:$PGID . /docker RUN chmod u+x /docker/entrypoint.sh && cp /docker/extra_model_paths.yaml ${ROOT} ENV NVIDIA_VISIBLE_DEVICES=all PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS="" From 04a09cb31c823a5c1e361df4e1e218b732eb689f Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:38:28 +0000 Subject: [PATCH 37/92] Update entrypoint.sh --- services/comfy/entrypoint.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/comfy/entrypoint.sh b/services/comfy/entrypoint.sh index b94ac10..f10eb66 100755 --- a/services/comfy/entrypoint.sh +++ b/services/comfy/entrypoint.sh @@ -28,8 +28,6 @@ if [ -f "/data/config/comfy/startup.sh" ]; then popd fi -chown -R root ~/.cache/ -chmod 766 ~/.cache/ chown -R $PUID:$PGID ~/.cache/ chmod 776 ~/.cache/ From 658ac3337180986c600952b4f04e972087cf196c Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:39:20 +0000 Subject: [PATCH 38/92] Update Dockerfile --- services/forge/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index a0c676d..3256e9c 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -103,7 +103,7 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ ENV LD_PRELOAD=libtcmalloc.so -COPY . /docker +COPY --chown=$PUID:$PGID . /docker RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ From 8efc56d3ad8b149ca82ef9db3f2731e3a1cf4f0e Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:44:58 +0000 Subject: [PATCH 39/92] Update Dockerfile --- services/forge/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index 3256e9c..c3e6f4a 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -82,7 +82,7 @@ ENV ROOT=/stable-diffusion-webui-forge COPY --from=download --chown=${PUID}:${PGID} /repositories/ ${ROOT}/repositories/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt # Clone and copy huggingface_guess module From 4bd3e0bed28bc27ed1d3f2427e6fa9a66479023c Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:48:31 +0000 Subject: [PATCH 40/92] Update Dockerfile --- services/fooocus/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/fooocus/Dockerfile b/services/fooocus/Dockerfile index 35ad916..890292b 100644 --- a/services/fooocus/Dockerfile +++ b/services/fooocus/Dockerfile @@ -57,7 +57,7 @@ RUN chown -R "$PUID:$PGID" /stable-diffusion-webui # drop permissions (if build targets non root) USER $PUID:$PGID -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ git clone https://github.com/lllyasviel/Fooocus.git ${ROOT} && \ cd ${ROOT} && \ git checkout ${BRANCH} && \ @@ -65,13 +65,13 @@ RUN --mount=type=cache,target=/root/.cache/pip \ pip install -r requirements_versions.txt -RUN --mount=type=cache,target=/root/.cache/pip \ +RUN --mount=type=cache,target=${USER_HOME}/.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 \ +RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ git fetch && \ git checkout ${BRANCH} && \ git reset --hard ${SHA} && \ From 07fc05329676ae5e1ace7f755a73c77e135f5380 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:50:08 +0000 Subject: [PATCH 41/92] Update Dockerfile --- services/download/Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/download/Dockerfile b/services/download/Dockerfile index a95ad03..78c11ee 100644 --- a/services/download/Dockerfile +++ b/services/download/Dockerfile @@ -1,6 +1,12 @@ FROM bash:alpine3.19 +ARG PUID=0 +ARG PGID=0 +# set build args as container environment variables for entrypoint reference +ENV PUID=$PUID +ENV PGID=$PGID + RUN apk update && apk add parallel aria2 -COPY . /docker +COPY --chown=$PUID:$PGID . /docker RUN chmod +x /docker/download.sh ENTRYPOINT ["/docker/download.sh"] From 6030daac7a2259f07310c14da2fae3111d51b21f Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 20:53:41 +0000 Subject: [PATCH 42/92] Update docker-compose.yml remove outdated invoke --- docker-compose.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 995427e..46c17b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,20 +42,7 @@ services: deploy: {} environment: - CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api - invoke: &invoke - <<: *base_service - profiles: ["invoke"] - build: ./services/invoke/ - image: sd-invoke:30 - environment: - - PRELOAD=true - - CLI_ARGS=--xformers - # invoke-cpu: - # <<: *invoke - # profiles: ["invoke-cpu"] - # environment: - # - PRELOAD=true - # - CLI_ARGS=--always_use_cpu + comfy: &comfy <<: *base_service profiles: ["comfy"] @@ -63,6 +50,7 @@ services: image: sd-comfy:6 environment: - CLI_ARGS= + comfy-cpu: <<: *comfy profiles: ["comfy-cpu"] @@ -76,4 +64,4 @@ services: build: ./services/fooocus/ image: sd-fooocus:3 environment: - - CLI_ARGS= \ No newline at end of file + - CLI_ARGS= From 7a1a86e168094eeea9c8df74a8b097df11289a1e Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:11:07 +0000 Subject: [PATCH 43/92] Update Dockerfile fix chmod and make consistent --- services/AUTOMATIC1111/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 8f6b91d..f14f93f 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -65,8 +65,10 @@ RUN if [ "$PUID" -ne "0" ]; then \ fi WORKDIR / +ENV ROOT=/stable-diffusion-webui + RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ - git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && \ + git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ${ROOT} && \ cd stable-diffusion-webui && \ git reset --hard v1.10.1 && \ pip install -r requirements_versions.txt @@ -77,7 +79,7 @@ RUN chown -R "$PUID:$PGID" /stable-diffusion-webui # drop permissions (if build targets non root) USER $PUID:$PGID -ENV ROOT=/stable-diffusion-webui + COPY --from=download --chown=${PUID}:${PGID} /repositories/ ${ROOT}/repositories/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate From 48955a1a98a2f867a88bcaf8cd777bf1282f93e0 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:12:25 +0000 Subject: [PATCH 44/92] Update Dockerfile fix chmod --- services/comfy/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index ec63220..3984675 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -41,7 +41,6 @@ RUN if [ "$PUID" -ne "0" ]; then \ echo "root group detected" ; \ fi -RUN chown -R "$PUID:$PGID" /stable-diffusion USER $PUID:$PGID ENV ROOT=/stable-diffusion @@ -52,6 +51,8 @@ RUN --mount=type=cache,target="$USER_HOME"/.cache/pip \ git reset --hard 276f8fce9f5a80b500947fb5745a4dde9e84622d && \ pip install -r requirements.txt +RUN chown -R "$PUID:$PGID" "${ROOT}" + WORKDIR ${ROOT} COPY --chown=$PUID:$PGID . /docker RUN chmod u+x /docker/entrypoint.sh && cp /docker/extra_model_paths.yaml ${ROOT} From 317055ffa0b2be21369c7f611d90ae69c931fd9d Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:12:46 +0000 Subject: [PATCH 45/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index f14f93f..b0b0792 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -75,7 +75,7 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ RUN pip install --upgrade typing-extensions -RUN chown -R "$PUID:$PGID" /stable-diffusion-webui +RUN chown -R "$PUID:$PGID" "${ROOT}" # drop permissions (if build targets non root) USER $PUID:$PGID From 7606b126100006f3d0ccf27120055e1d4766c2d8 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:13:23 +0000 Subject: [PATCH 46/92] Update Dockerfile --- services/fooocus/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/fooocus/Dockerfile b/services/fooocus/Dockerfile index 890292b..c3a77fb 100644 --- a/services/fooocus/Dockerfile +++ b/services/fooocus/Dockerfile @@ -45,14 +45,12 @@ RUN if [ "$PUID" -ne "0" ]; then \ echo "root group detected" ; \ fi - - # set this to your target branch commit ARG BRANCH=main SHA=e2f9bcb11d06216d6800676c48d8d74d6fd77a4b ENV ROOT=/stable-diffusion -RUN chown -R "$PUID:$PGID" /stable-diffusion-webui +RUN chown -R "$PUID:$PGID" "${ROOT}" # drop permissions (if build targets non root) USER $PUID:$PGID From 0f94b77773f93c65e2e8b19643a581dfb9f95e8f Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:14:20 +0000 Subject: [PATCH 47/92] Update Dockerfile --- services/forge/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index c3e6f4a..2134893 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -65,6 +65,7 @@ RUN if [ "$PUID" -ne "0" ]; then \ echo "root group detected" ; \ fi +ENV ROOT=/stable-diffusion-webui-forge WORKDIR / RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ @@ -73,12 +74,11 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ sed -i '/torch/d' requirements_versions.txt && \ pip install -r requirements_versions.txt -RUN chown -R "$PUID:$PGID" /stable-diffusion-webui-forge +RUN chown -R "$PUID:$PGID" "${ROOT}" # drop permissions (if build targets non root) USER $PUID:$PGID -ENV ROOT=/stable-diffusion-webui-forge COPY --from=download --chown=${PUID}:${PGID} /repositories/ ${ROOT}/repositories/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate From afcef580cc97c6113ff1eca3b1b0ad2c85e6596f Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:15:04 +0000 Subject: [PATCH 48/92] Update docker.yml add additional interfaces --- .github/workflows/docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index db5d840..1790590 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -16,6 +16,8 @@ jobs: - auto - comfy - download + - fooocus + - forge runs-on: ubuntu-latest name: ${{ matrix.profile }} steps: From 3e25d0a77c17e4e2e89d9612726233aad9c63427 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:19:25 +0000 Subject: [PATCH 49/92] Update Dockerfile fix chown --- services/fooocus/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/fooocus/Dockerfile b/services/fooocus/Dockerfile index c3a77fb..08b9b5f 100644 --- a/services/fooocus/Dockerfile +++ b/services/fooocus/Dockerfile @@ -50,7 +50,6 @@ ARG BRANCH=main SHA=e2f9bcb11d06216d6800676c48d8d74d6fd77a4b ENV ROOT=/stable-diffusion -RUN chown -R "$PUID:$PGID" "${ROOT}" # drop permissions (if build targets non root) USER $PUID:$PGID @@ -62,6 +61,7 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ git reset --hard ${SHA} && \ pip install -r requirements_versions.txt +RUN chown -R "$PUID:$PGID" "${ROOT}" RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ --mount=type=bind,from=xformers,source=/wheel.whl,target=/xformers-0.0.21-cp310-cp310-linux_x86_64.whl \ From f4d803ac8ff4ecc7bb812a99175c0c8ed899a30a Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:32:39 +0000 Subject: [PATCH 50/92] Update docker.yml try building images --- .github/workflows/docker.yml | 60 +++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1790590..9f67e40 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,14 +12,58 @@ jobs: build: strategy: matrix: - profile: - - auto - - comfy - - download - - fooocus - - forge + include: + - image: simonmcnair/AUTOMATIC1111 + dockerfile: services/AUTOMATIC1111/Dockerfile + context: services/AUTOMATIC1111/ + + - image: simonmcnair/comfy + dockerfile: services/comfy/Dockerfile + context: services/comfy/ + + - image: simonmcnair/download + dockerfile: services/download/Dockerfile + context: services/download/ + + - image: simonmcnair/fooocus + dockerfile: services/fooocus/Dockerfile + context: services/fooocus/ + + - image: simonmcnair/forge + dockerfile: services/forge/Dockerfile + context: services/forge/ + runs-on: ubuntu-latest name: ${{ matrix.profile }} steps: - - uses: actions/checkout@v3 - - run: docker compose --profile ${{ matrix.profile }} build --progress plain + # - uses: actions/checkout@v3 + # - run: docker compose --profile ${{ matrix.profile }} build --progress plain + + - name: Checkout + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ matrix.image }} + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: ${{ matrix.context }} + file: ${{ matrix.dockerfile }} + push: true + #This is needed because it is called main instead of master to get the latest tag in docker + tags: | + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + #tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 85ffaee78c0fdf7fdf631021feb0847efba4baef Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:34:48 +0000 Subject: [PATCH 51/92] Update docker.yml --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9f67e40..7315f94 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -48,8 +48,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 From 5b8136312713b0c33faddfda4027f13c548a860f Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 21:37:28 +0000 Subject: [PATCH 52/92] Update docker.yml --- .github/workflows/docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7315f94..665c9c0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -62,8 +62,8 @@ jobs: file: ${{ matrix.dockerfile }} push: true #This is needed because it is called main instead of master to get the latest tag in docker - tags: | + # tags: | # set latest tag for default branch - type=raw,value=latest,enable={{is_default_branch}} - #tags: ${{ steps.meta.outputs.tags }} + # type=raw,value=latest,enable={{is_default_branch}} + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 8f74cec7f91914e91ff9a42976531cef878b8664 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 22:18:55 +0000 Subject: [PATCH 53/92] Update Dockerfile sed needs root for the dir it's in --- services/forge/Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index 2134893..d9464f4 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -76,6 +76,12 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ RUN chown -R "$PUID:$PGID" "${ROOT}" +RUN \ + # mv ${ROOT}/style.css ${ROOT}/user.css && \ + # one of the ugliest hacks I ever wrote \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ + git config --global --add safe.directory '*' + # drop permissions (if build targets non root) USER $PUID:$PGID @@ -105,11 +111,6 @@ ENV LD_PRELOAD=libtcmalloc.so COPY --chown=$PUID:$PGID . /docker -RUN \ - # mv ${ROOT}/style.css ${ROOT}/user.css && \ - # one of the ugliest hacks I ever wrote \ - sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ - git config --global --add safe.directory '*' WORKDIR ${ROOT} ENV NVIDIA_VISIBLE_DEVICES=all From c5c5b2b6f028105a5e75a6ee31f735c5c1f71fe1 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 22:19:20 +0000 Subject: [PATCH 54/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index b0b0792..72e6a20 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -77,6 +77,13 @@ RUN pip install --upgrade typing-extensions RUN chown -R "$PUID:$PGID" "${ROOT}" +RUN \ + # mv ${ROOT}/style.css ${ROOT}/user.css && \ + # one of the ugliest hacks I ever wrote \ + # updated from 3.10.to 3.11 + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.11/site-packages/gradio/routes.py && \ + git config --global --add safe.directory '*' + # drop permissions (if build targets non root) USER $PUID:$PGID @@ -95,12 +102,6 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ ENV LD_PRELOAD=libtcmalloc.so COPY --chown=$PUID:$PGID . /docker -RUN \ - # mv ${ROOT}/style.css ${ROOT}/user.css && \ - # one of the ugliest hacks I ever wrote \ - # updated from 3.10.to 3.11 - sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.11/site-packages/gradio/routes.py && \ - git config --global --add safe.directory '*' WORKDIR ${ROOT} ENV NVIDIA_VISIBLE_DEVICES=all From bfd834d8be4b43a77d5518ed2d59e7898135edc1 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 23:19:46 +0000 Subject: [PATCH 55/92] Update Dockerfile testing --- services/AUTOMATIC1111/Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 72e6a20..8cafbd2 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -67,7 +67,7 @@ RUN if [ "$PUID" -ne "0" ]; then \ WORKDIR / ENV ROOT=/stable-diffusion-webui -RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ +RUN --mount=type=cache,target=/root/.cache/sd \ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ${ROOT} && \ cd stable-diffusion-webui && \ git reset --hard v1.10.1 && \ @@ -75,7 +75,6 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ RUN pip install --upgrade typing-extensions -RUN chown -R "$PUID:$PGID" "${ROOT}" RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ @@ -85,13 +84,13 @@ RUN \ git config --global --add safe.directory '*' # drop permissions (if build targets non root) -USER $PUID:$PGID +#USER $PUID:$PGID COPY --from=download --chown=${PUID}:${PGID} /repositories/ ${ROOT}/repositories/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate -RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ +RUN --mount=type=cache,target=/root/.cache/repos \ pip install pyngrok xformers==0.0.26.post1 \ git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ @@ -101,7 +100,9 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ # maybe move this up to the dependencies list. ENV LD_PRELOAD=libtcmalloc.so -COPY --chown=$PUID:$PGID . /docker +COPY . /docker +RUN chown -R "$PUID:$PGID" "${ROOT}" +RUN chown -R "$PUID:$PGID" /docker WORKDIR ${ROOT} ENV NVIDIA_VISIBLE_DEVICES=all From 56564585a134fdc7b2b26921f25f31d18f8bcf9d Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 10 Mar 2025 23:22:40 +0000 Subject: [PATCH 56/92] Update Dockerfile test --- services/forge/Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index d9464f4..038b2f7 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -20,7 +20,7 @@ FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 -RUN --mount=type=cache,target=/var/cache/apt \ +RUN --mount=type=cache,target=/root/apt \ apt-get update && \ # we need those apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ @@ -68,13 +68,12 @@ RUN if [ "$PUID" -ne "0" ]; then \ ENV ROOT=/stable-diffusion-webui-forge WORKDIR / -RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ +RUN --mount=type=cache,target=/root/.cache/forge-repo \ git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git && \ cd stable-diffusion-webui-forge && \ sed -i '/torch/d' requirements_versions.txt && \ pip install -r requirements_versions.txt -RUN chown -R "$PUID:$PGID" "${ROOT}" RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ @@ -88,18 +87,16 @@ USER $PUID:$PGID COPY --from=download --chown=${PUID}:${PGID} /repositories/ ${ROOT}/repositories/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate -RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ - pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt +RUN --mount=type=cache,target=/root/.cache/codeformer pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt # Clone and copy huggingface_guess module #RUN git clone https://github.com/lllyasviel/huggingface_guess.git /tmp/huggingface_guess && \ # cp -r /tmp/huggingface_guess/huggingface_guess ${ROOT}/huggingface_guess # Ensure torchvision is correctly installed -RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ - pip install torchvision==0.18.1 +RUN --mount=type=cache,target=/root/.cache/torch pip install torchvision==0.18.1 -RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ +RUN --mount=type=cache,target=/root/.cache/repos \ pip install pyngrok xformers==0.0.27 pytorch_lightning torchdiffeq torchsde \ git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ @@ -109,7 +106,10 @@ RUN --mount=type=cache,target=${USER_HOME}/.cache/pip \ ENV LD_PRELOAD=libtcmalloc.so -COPY --chown=$PUID:$PGID . /docker +COPY . /docker + +RUN chown -R "$PUID:$PGID" "${ROOT}" +RUN chown -R "$PUID:$PGID" /docker WORKDIR ${ROOT} From 039559e348e69272aa8d6ae485889df019325ab3 Mon Sep 17 00:00:00 2001 From: Simon McNair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 19:07:45 +0000 Subject: [PATCH 57/92] add reforge --- .../tmp_dockerfile => reforge/Dockerfile} | 35 ++++++-- services/reforge/clone.sh | 11 +++ services/reforge/config.py | 78 +++++++++++++++++ services/reforge/entrypoint.sh | 85 +++++++++++++++++++ 4 files changed, 201 insertions(+), 8 deletions(-) rename services/{forge/tmp_dockerfile => reforge/Dockerfile} (55%) create mode 100644 services/reforge/clone.sh create mode 100644 services/reforge/config.py create mode 100755 services/reforge/entrypoint.sh diff --git a/services/forge/tmp_dockerfile b/services/reforge/Dockerfile similarity index 55% rename from services/forge/tmp_dockerfile rename to services/reforge/Dockerfile index 301d025..86f58e9 100644 --- a/services/forge/tmp_dockerfile +++ b/services/reforge/Dockerfile @@ -1,3 +1,20 @@ +FROM alpine/git:2.36.2 AS download + +COPY clone.sh /clone.sh + +RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf \ + && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif + +RUN . /clone.sh CodeFormer https://github.com/sczhou/CodeFormer.git c5b4593074ba6214284d6acd5f1719b6c5d739af \ + && rm -rf assets inputs + +RUN . /clone.sh BLIP https://github.com/salesforce/BLIP.git 48211a1594f1321b00f14c9f7a5b4813144b2fb9 +RUN . /clone.sh k-diffusion https://github.com/crowsonkb/k-diffusion.git ab527a9a6d347f364e3d185ba6d714e22d80cb3c +RUN . /clone.sh clip-interrogator https://github.com/pharmapsychotic/clip-interrogator 2cf03aaf6e704197fd0dae7c7f96aa59cf1b11c9 +RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-models 45c443b316737a4ab6e40413d7794a7f5657c19f +RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git 6f7db241d2f8ba7457bac5ca9753331f0c266917 + + FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 @@ -9,13 +26,15 @@ RUN --mount=type=cache,target=/var/cache/apt \ # extensions needs those ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential + WORKDIR / RUN --mount=type=cache,target=/root/.cache/pip \ - git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git && \ - cd stable-diffusion-webui-forge && \ + git clone https://github.com/Panchovix/stable-diffusion-webui-reForge.git /stable-diffusion-webui-reforge && \ + cd stable-diffusion-webui-reforge && \ + sed -i '/torch/d' requirements_versions.txt && \ pip install -r requirements_versions.txt -ENV ROOT=/stable-diffusion-webui-forge +ENV ROOT=/stable-diffusion-webui-reforge COPY --from=download /repositories/ ${ROOT}/repositories/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate @@ -28,14 +47,13 @@ RUN git clone https://github.com/lllyasviel/huggingface_guess.git /tmp/huggingfa # Ensure torchvision is correctly installed RUN --mount=type=cache,target=/root/.cache/pip \ - pip install --upgrade torchvision + pip install torchvision==0.18.1 RUN --mount=type=cache,target=/root/.cache/pip \ - pip install pyngrok xformers==0.0.23.post1 \ + pip install pyngrok xformers==0.0.27 pytorch_lightning torchdiffeq torchsde \ git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ - git+https://github.com/mlfoundations/open_clip.git@v2.20.0 - + git+https://github.com/mlfoundations/open_clip.git@v2.20.0 # there seems to be a memory leak (or maybe just memory not being freed fast enough) that is fixed by this version of malloc # maybe move this up to the dependencies list. RUN apt-get -y install libgoogle-perftools-dev && apt-get clean @@ -44,11 +62,12 @@ ENV LD_PRELOAD=libtcmalloc.so COPY . /docker RUN \ + # mv ${ROOT}/style.css ${ROOT}/user.css && \ + # one of the ugliest hacks I ever wrote \ sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ git config --global --add safe.directory '*' WORKDIR ${ROOT} -ENV PYTHONPATH=${ROOT}:${PYTHONPATH} ENV NVIDIA_VISIBLE_DEVICES=all ENV CLI_ARGS="" EXPOSE 7860 diff --git a/services/reforge/clone.sh b/services/reforge/clone.sh new file mode 100644 index 0000000..2c37c41 --- /dev/null +++ b/services/reforge/clone.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -Eeuox pipefail + +mkdir -p /repositories/"$1" +cd /repositories/"$1" +git init +git remote add origin "$2" +git fetch origin "$3" --depth=1 +git reset --hard "$3" +rm -rf .git \ No newline at end of file diff --git a/services/reforge/config.py b/services/reforge/config.py new file mode 100644 index 0000000..7db2f54 --- /dev/null +++ b/services/reforge/config.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 + +"""Checks and sets default values for config.json before starting the container.""" + +import json +import re +import os.path +import sys + +DEFAULT_FILEPATH = '/data/config/reforge/config.json' + +DEFAULT_OUTDIRS = { + "outdir_samples": "", + "outdir_txt2img_samples": "/output/txt2img", + "outdir_img2img_samples": "/output/img2img", + "outdir_extras_samples": "/output/extras", + "outdir_grids": "", + "outdir_txt2img_grids": "/output/txt2img-grids", + "outdir_img2img_grids": "/output/img2img-grids", + "outdir_save": "/output/saved", + "outdir_init_images": "/output/init-images", +} +RE_VALID_OUTDIR = re.compile(r"(^/output(/\.?[\w\-\_]+)+/?$)|(^\s?$)") + +DEFAULT_OTHER = { + "font": "DejaVuSans.ttf", +} + +def dict_to_json_file(target_file: str, data: dict): + """Write dictionary to specified json file""" + + with open(target_file, 'w') as f: + json.dump(data, f) + +def json_file_to_dict(config_file: str) -> dict|None: + """Load json file into a dictionary. Return None if file does not exist.""" + + if os.path.isfile(config_file): + with open(config_file, 'r') as f: + return json.load(f) + else: + return None + +def replace_if_invalid(value: str, replacement: str, pattern: str|re.Pattern[str]) -> str: + """Returns original value if valid, fallback value if invalid""" + + if re.match(pattern, value): + return value + else: + return replacement + +def check_and_replace_config(config_file: str, target_file: str = None): + """Checks given file for invalid values. Replaces those with fallback values (default: overwrites file).""" + + # Get current user config, or empty if file does not exists + data = json_file_to_dict(config_file) or {} + + # Check and fix output directories + for k, def_val in DEFAULT_OUTDIRS.items(): + if k not in data: + data[k] = def_val + else: + data[k] = replace_if_invalid(value=data[k], replacement=def_val, pattern=RE_VALID_OUTDIR) + + # Check and fix other default settings + for k, def_val in DEFAULT_OTHER.items(): + if k not in data: + data[k] = def_val + + # Write results to file + dict_to_json_file(target_file or config_file, data) + +if __name__ == '__main__': + if len(sys.argv) > 1: + check_and_replace_config(*sys.argv[1:]) + else: + check_and_replace_config(DEFAULT_FILEPATH) + diff --git a/services/reforge/entrypoint.sh b/services/reforge/entrypoint.sh new file mode 100755 index 0000000..1ef5400 --- /dev/null +++ b/services/reforge/entrypoint.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +set -Eeuo pipefail + +# TODO: move all mkdir -p ? +mkdir -p /data/config/reforge/scripts/ +# mount scripts individually + +echo $ROOT +ls -lha $ROOT + +find "${ROOT}/scripts/" -maxdepth 1 -type l -delete +cp -vrfTs /data/config/reforge/scripts/ "${ROOT}/scripts/" + +# Set up config file +python /docker/config.py /data/config/reforge/config.json + +if [ ! -f /data/config/reforge/ui-config.json ]; then + echo '{}' >/data/config/reforge/ui-config.json +fi + +if [ ! -f /data/config/reforge/styles.csv ]; then + touch /data/config/reforge/styles.csv +fi + +# copy models from original models folder +mkdir -p /data/models/VAE-approx/ /data/models/karlo/ + +rsync -a --info=NAME ${ROOT}/models/VAE-approx/ /data/models/VAE-approx/ +rsync -a --info=NAME ${ROOT}/models/karlo/ /data/models/karlo/ + +declare -A MOUNTS + +MOUNTS["/root/.cache"]="/data/.cache" +MOUNTS["${ROOT}/models"]="/data/models" + +MOUNTS["${ROOT}/embeddings"]="/data/embeddings" +MOUNTS["${ROOT}/config.json"]="/data/config/reforge/config.json" +MOUNTS["${ROOT}/ui-config.json"]="/data/config/reforge/ui-config.json" +MOUNTS["${ROOT}/styles.csv"]="/data/config/reforge/styles.csv" +MOUNTS["${ROOT}/extensions"]="/data/config/reforge/extensions" +MOUNTS["${ROOT}/config_states"]="/data/config/reforge/config_states" + +# extra hacks +MOUNTS["${ROOT}/repositories/CodeFormer/weights/facelib"]="/data/.cache" + +for to_path in "${!MOUNTS[@]}"; do + set -Eeuo pipefail + from_path="${MOUNTS[${to_path}]}" + rm -rf "${to_path}" + if [ ! -f "$from_path" ]; then + mkdir -vp "$from_path" + fi + mkdir -vp "$(dirname "${to_path}")" + ln -sT "${from_path}" "${to_path}" + echo Mounted $(basename "${from_path}") +done + +echo "Installing extension dependencies (if any)" + +# because we build our container as root: +chown -R root ~/.cache/ +chmod 766 ~/.cache/ + +shopt -s nullglob +# For install.py, please refer to https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Developing-extensions#installpy +list=(./extensions/*/install.py) +for installscript in "${list[@]}"; do + EXTNAME=$(echo $installscript | cut -d '/' -f 3) + # Skip installing dependencies if extension is disabled in config + if $(jq -e ".disabled_extensions|any(. == \"$EXTNAME\")" config.json); then + echo "Skipping disabled extension ($EXTNAME)" + continue + fi + PYTHONPATH=${ROOT} python "$installscript" +done + +if [ -f "/data/config/reforge/startup.sh" ]; then + pushd ${ROOT} + echo "Running startup script" + . /data/config/reforge/startup.sh + popd +fi + +exec "$@" From b5ebd4c70948a73d91fa4b530e94bb5b654eb5e1 Mon Sep 17 00:00:00 2001 From: Simon McNair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 19:09:13 +0000 Subject: [PATCH 58/92] add reforge --- docker-compose.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 46c17b0..3b0b257 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,15 @@ services: environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api - forge: &forge + forge: &reforge + <<: *base_service + profiles: ["reforge"] + build: ./services/reforge + image: sd-reforge:80 + environment: + - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream + + reforge: &forge <<: *base_service profiles: ["forge"] build: ./services/forge From d32b186968098527ad8f81b3facbd6e48e04d6df Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 19:19:00 +0000 Subject: [PATCH 59/92] Update docker-compose.yml fix --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3b0b257..f48837c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api - forge: &reforge + reforge: &reforge <<: *base_service profiles: ["reforge"] build: ./services/reforge @@ -36,7 +36,7 @@ services: environment: - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream - reforge: &forge + forge: &forge <<: *base_service profiles: ["forge"] build: ./services/forge From bd2fcce6b4bba4c718c371c1af369cdde85f2808 Mon Sep 17 00:00:00 2001 From: Simon McNair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 19:24:09 +0000 Subject: [PATCH 60/92] try and fix error --- services/reforge/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/reforge/Dockerfile b/services/reforge/Dockerfile index 86f58e9..30332ce 100644 --- a/services/reforge/Dockerfile +++ b/services/reforge/Dockerfile @@ -47,10 +47,10 @@ RUN git clone https://github.com/lllyasviel/huggingface_guess.git /tmp/huggingfa # Ensure torchvision is correctly installed RUN --mount=type=cache,target=/root/.cache/pip \ - pip install torchvision==0.18.1 + pip install torchvision==0.18.1 RUN --mount=type=cache,target=/root/.cache/pip \ - pip install pyngrok xformers==0.0.27 pytorch_lightning torchdiffeq torchsde \ + pip install pyngrok xformers==0.0.27 pytorch_lightning==1.6.5 torchdiffeq torchsde \ git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ git+https://github.com/mlfoundations/open_clip.git@v2.20.0 From db36a12d00f45173387818dde6dbfffc65d33414 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 19:45:49 +0000 Subject: [PATCH 61/92] Update Dockerfile try and fix pydantic error --- services/reforge/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/reforge/Dockerfile b/services/reforge/Dockerfile index 30332ce..e9845cf 100644 --- a/services/reforge/Dockerfile +++ b/services/reforge/Dockerfile @@ -60,6 +60,7 @@ RUN apt-get -y install libgoogle-perftools-dev && apt-get clean ENV LD_PRELOAD=libtcmalloc.so COPY . /docker +RUN pip install --upgrade pydantic RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ @@ -72,4 +73,4 @@ ENV NVIDIA_VISIBLE_DEVICES=all ENV CLI_ARGS="" EXPOSE 7860 ENTRYPOINT ["/docker/entrypoint.sh"] -CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} \ No newline at end of file +CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} From d92e9ab826e7581faea7b48e3b5a7f8388ff1252 Mon Sep 17 00:00:00 2001 From: Simon McNair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 20:27:56 +0000 Subject: [PATCH 62/92] set pydantic --- services/reforge/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/reforge/Dockerfile b/services/reforge/Dockerfile index e9845cf..f66d547 100644 --- a/services/reforge/Dockerfile +++ b/services/reforge/Dockerfile @@ -60,7 +60,7 @@ RUN apt-get -y install libgoogle-perftools-dev && apt-get clean ENV LD_PRELOAD=libtcmalloc.so COPY . /docker -RUN pip install --upgrade pydantic +RUN pip install pydantic ==1.10.21 RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ From 0cf468b80b6974ab9caee4cde2fdec209d34b64c Mon Sep 17 00:00:00 2001 From: Simon McNair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 20:29:51 +0000 Subject: [PATCH 63/92] oops --- services/reforge/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/reforge/Dockerfile b/services/reforge/Dockerfile index f66d547..d52c0c9 100644 --- a/services/reforge/Dockerfile +++ b/services/reforge/Dockerfile @@ -60,7 +60,7 @@ RUN apt-get -y install libgoogle-perftools-dev && apt-get clean ENV LD_PRELOAD=libtcmalloc.so COPY . /docker -RUN pip install pydantic ==1.10.21 +RUN pip install pydantic==1.10.21 RUN \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ From 9a73fad1142afe733b72541589f170362bee0871 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 20:51:12 +0000 Subject: [PATCH 64/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 8cafbd2..785f2b5 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -2,6 +2,9 @@ FROM alpine/git:2.36.2 AS download COPY clone.sh /clone.sh +RUN rm -rf "/usr/local/share/boost" +RUN rm -rf "$AGENT_TOOLSDIRECTORY" + RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git 6f7db241d2f8ba7457bac5ca9753331f0c266917 RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf \ From 53153c6f3265cedd223e057c8d9ea5d74bd3443f Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 21:17:01 +0000 Subject: [PATCH 65/92] Update Dockerfile trying something --- services/AUTOMATIC1111/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 785f2b5..a0ccd12 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -73,8 +73,8 @@ ENV ROOT=/stable-diffusion-webui RUN --mount=type=cache,target=/root/.cache/sd \ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ${ROOT} && \ cd stable-diffusion-webui && \ - git reset --hard v1.10.1 && \ - pip install -r requirements_versions.txt + git reset --hard v1.10.1 # && \ + #pip install -r requirements_versions.txt RUN pip install --upgrade typing-extensions From 8fe07a18e3241fe99eb07efcb3c69fe687786b04 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 21:22:13 +0000 Subject: [PATCH 66/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index a0ccd12..1674103 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -17,8 +17,8 @@ RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-mod RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets 6f7db241d2f8ba7457bac5ca9753331f0c266917 -#FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime -FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime +FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime +#FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 @@ -74,7 +74,7 @@ RUN --mount=type=cache,target=/root/.cache/sd \ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ${ROOT} && \ cd stable-diffusion-webui && \ git reset --hard v1.10.1 # && \ - #pip install -r requirements_versions.txt + pip install -r requirements_versions.txt RUN pip install --upgrade typing-extensions From c417634e1f282fe72e8c8e28d8d8b6e8e312e6ef Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 21:26:20 +0000 Subject: [PATCH 67/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 1674103..a4269dd 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -73,7 +73,7 @@ ENV ROOT=/stable-diffusion-webui RUN --mount=type=cache,target=/root/.cache/sd \ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git ${ROOT} && \ cd stable-diffusion-webui && \ - git reset --hard v1.10.1 # && \ + git reset --hard v1.10.1 && \ pip install -r requirements_versions.txt RUN pip install --upgrade typing-extensions From fe62a0ff0beba3123e16a8e045d3b47fb434ac0a Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 21:51:14 +0000 Subject: [PATCH 68/92] Update Dockerfile try a fix --- services/AUTOMATIC1111/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index a4269dd..cc38822 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -79,11 +79,14 @@ RUN --mount=type=cache,target=/root/.cache/sd \ RUN pip install --upgrade typing-extensions -RUN \ +RUN if [ -d "/opt/conda/lib/python3.10" ]; then \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py ;\ + elif [ -d "/opt/conda/lib/python3.11" ]; then \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.11/site-packages/gradio/routes.py ;\ + fi && \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ # one of the ugliest hacks I ever wrote \ # updated from 3.10.to 3.11 - sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.11/site-packages/gradio/routes.py && \ git config --global --add safe.directory '*' # drop permissions (if build targets non root) From a740f9da6d6ac1a83669a8f4b6ec19d842cfea46 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 22:03:43 +0000 Subject: [PATCH 69/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index cc38822..87d2fb6 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -80,8 +80,10 @@ RUN pip install --upgrade typing-extensions RUN if [ -d "/opt/conda/lib/python3.10" ]; then \ + echo Python 3.10 detected; \ sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py ;\ elif [ -d "/opt/conda/lib/python3.11" ]; then \ + echo Python 3.11 detected; \ sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.11/site-packages/gradio/routes.py ;\ fi && \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ From 9a36d6bf354508560fb350b09252b304933bd6ef Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 22:05:33 +0000 Subject: [PATCH 70/92] Update Dockerfile --- services/forge/Dockerfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/services/forge/Dockerfile b/services/forge/Dockerfile index 038b2f7..2f20389 100644 --- a/services/forge/Dockerfile +++ b/services/forge/Dockerfile @@ -74,13 +74,20 @@ RUN --mount=type=cache,target=/root/.cache/forge-repo \ sed -i '/torch/d' requirements_versions.txt && \ pip install -r requirements_versions.txt - -RUN \ +RUN if [ -d "/opt/conda/lib/python3.10" ]; then \ + echo Python 3.10 detected; \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py ;\ + elif [ -d "/opt/conda/lib/python3.11" ]; then \ + echo Python 3.11 detected; \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.11/site-packages/gradio/routes.py ;\ + fi && \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ # one of the ugliest hacks I ever wrote \ - sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ + # updated from 3.10.to 3.11 git config --global --add safe.directory '*' + + # drop permissions (if build targets non root) USER $PUID:$PGID From 3db97c9c173cecb3f51a0ccd375767df024ccf28 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 22:05:54 +0000 Subject: [PATCH 71/92] Update Dockerfile --- services/reforge/Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/reforge/Dockerfile b/services/reforge/Dockerfile index d52c0c9..1e625db 100644 --- a/services/reforge/Dockerfile +++ b/services/reforge/Dockerfile @@ -62,12 +62,20 @@ ENV LD_PRELOAD=libtcmalloc.so COPY . /docker RUN pip install pydantic==1.10.21 -RUN \ +RUN if [ -d "/opt/conda/lib/python3.10" ]; then \ + echo Python 3.10 detected; \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py ;\ + elif [ -d "/opt/conda/lib/python3.11" ]; then \ + echo Python 3.11 detected; \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.11/site-packages/gradio/routes.py ;\ + fi && \ # mv ${ROOT}/style.css ${ROOT}/user.css && \ # one of the ugliest hacks I ever wrote \ - sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ + # updated from 3.10.to 3.11 git config --global --add safe.directory '*' + + WORKDIR ${ROOT} ENV NVIDIA_VISIBLE_DEVICES=all ENV CLI_ARGS="" From 9a9111d6400555233409a701b194cb5597a996ca Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 24 Mar 2025 22:07:36 +0000 Subject: [PATCH 72/92] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 01872d9..c973e68 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ I have forked this as AbdBarho hasn't been around for a while. I'm not great wi I am happy to look at PR's as and when. Also happy to pass this back, as and whe, and if, they return. +supports: +- AUTOMATIC1111 +- comfy +- fooocus +- forge +- reforge # Stable Diffusion WebUI Docker From 894b87722b118c01ddc4743cfc35b79feacee40a Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:17:55 +0100 Subject: [PATCH 73/92] Update Dockerfile update Pytorch and add comfy manager --- services/comfy/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index 3984675..5a6203f 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -1,4 +1,4 @@ -FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime +FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 @@ -51,6 +51,9 @@ RUN --mount=type=cache,target="$USER_HOME"/.cache/pip \ git reset --hard 276f8fce9f5a80b500947fb5745a4dde9e84622d && \ pip install -r requirements.txt +RUN git clone -b 3.6.5 --depth=1 https://github.com/ltdrdata/ComfyUI-Manager ${ROOT}/custom_nodes/comfyui-manager && \ + pip install -r ${ROOT}/custom_nodes/comfyui-manager/requirements.txt + RUN chown -R "$PUID:$PGID" "${ROOT}" WORKDIR ${ROOT} From d6d46fc92d70a1bfd5426107f6079c556eb95cb5 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:19:19 +0100 Subject: [PATCH 74/92] Update Dockerfile change comfy to 3.10 --- services/comfy/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index 5a6203f..eb1a9e9 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -45,7 +45,7 @@ USER $PUID:$PGID ENV ROOT=/stable-diffusion RUN --mount=type=cache,target="$USER_HOME"/.cache/pip \ - git clone https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \ + git clone -b v0.3.10 --depth=1 https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \ cd ${ROOT} && \ git checkout master && \ git reset --hard 276f8fce9f5a80b500947fb5745a4dde9e84622d && \ From f3df34b7ca245834a2396a6e795caafb4206edb7 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:20:41 +0100 Subject: [PATCH 75/92] Update docker-compose.yml add AMD rocm --- docker-compose.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index f48837c..b58b9c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,6 +28,19 @@ services: environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api + auto-rocm: + <<: *base_service + profiles: ["auto-rocm"] + build: + context: ./services/AUTOMATIC1111 + dockerfile: Dockerfile.rocm + devices: + - "/dev/kfd" + - "/dev/dri" + deploy: {} + environment: + - CLI_ARGS=--allow-code --medvram --enable-insecure-extension-access --api + reforge: &reforge <<: *base_service profiles: ["reforge"] From 8b6b82ebc06f11f6d861a693d5a005643afe316d Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:22:04 +0100 Subject: [PATCH 76/92] Create Dockerfile.rocm first try --- services/AUTOMATIC1111/Dockerfile.rocm | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 services/AUTOMATIC1111/Dockerfile.rocm diff --git a/services/AUTOMATIC1111/Dockerfile.rocm b/services/AUTOMATIC1111/Dockerfile.rocm new file mode 100644 index 0000000..47a39c0 --- /dev/null +++ b/services/AUTOMATIC1111/Dockerfile.rocm @@ -0,0 +1,70 @@ +FROM alpine/git:2.36.2 as download + +COPY clone.sh /clone.sh + + +RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf \ + && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif + +RUN . /clone.sh CodeFormer https://github.com/sczhou/CodeFormer.git c5b4593074ba6214284d6acd5f1719b6c5d739af \ + && rm -rf assets inputs + +RUN . /clone.sh BLIP https://github.com/salesforce/BLIP.git 48211a1594f1321b00f14c9f7a5b4813144b2fb9 +RUN . /clone.sh k-diffusion https://github.com/crowsonkb/k-diffusion.git ab527a9a6d347f364e3d185ba6d714e22d80cb3c +RUN . /clone.sh clip-interrogator https://github.com/pharmapsychotic/clip-interrogator 2cf03aaf6e704197fd0dae7c7f96aa59cf1b11c9 +RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-models 45c443b316737a4ab6e40413d7794a7f5657c19f + + +FROM rocm/pytorch:rocm6.0.2_ubuntu22.04_py3.10_pytorch_2.1.2 + +ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 + +RUN --mount=type=cache,target=/var/cache/apt \ + apt-get update && \ + # we need those + apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ + # extensions needs those + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential + + +RUN python -m pip install --upgrade pip wheel + +WORKDIR / +RUN --mount=type=cache,target=/root/.cache/pip \ + git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && \ + cd stable-diffusion-webui && \ + git reset --hard cf2772fab0af5573da775e7437e6acdca424f26e && \ + pip install -r requirements_versions.txt + + +ENV ROOT=/stable-diffusion-webui + +COPY --from=download /repositories/ ${ROOT}/repositories/ +RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt + +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install pyngrok xformers==0.0.23.post1 \ + git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ + git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ + git+https://github.com/mlfoundations/open_clip.git@v2.20.0 + +# there seems to be a memory leak (or maybe just memory not being freed fast enough) that is fixed by this version of malloc +# maybe move this up to the dependencies list. +RUN apt-get -y install libgoogle-perftools-dev && apt-get clean +ENV LD_PRELOAD=libtcmalloc.so + +COPY . /docker + +RUN \ + # mv ${ROOT}/style.css ${ROOT}/user.css && \ + # one of the ugliest hacks I ever wrote \ + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/envs/py_3.10/lib/python3.10/site-packages/gradio/routes.py && \ + git config --global --add safe.directory '*' + +WORKDIR ${ROOT} +ENV CLI_ARGS="" +EXPOSE 7860 +ENTRYPOINT ["/docker/entrypoint.sh"] +CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} From c40d41563d3c4c328ec26e23f572324c0c728ba4 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:35:06 +0100 Subject: [PATCH 77/92] Update Dockerfile Fix for build --- services/comfy/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index eb1a9e9..ded3cb6 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -45,10 +45,8 @@ USER $PUID:$PGID ENV ROOT=/stable-diffusion RUN --mount=type=cache,target="$USER_HOME"/.cache/pip \ - git clone -b v0.3.10 --depth=1 https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \ cd ${ROOT} && \ - git checkout master && \ - git reset --hard 276f8fce9f5a80b500947fb5745a4dde9e84622d && \ + git clone -b v0.3.10 --depth=1 https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \ pip install -r requirements.txt RUN git clone -b 3.6.5 --depth=1 https://github.com/ltdrdata/ComfyUI-Manager ${ROOT}/custom_nodes/comfyui-manager && \ From f1eed95e2588fa4b143ee19840ad1b15b56580e6 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 9 Apr 2025 10:56:09 +0100 Subject: [PATCH 78/92] Update Dockerfile fix for failed build --- services/comfy/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index ded3cb6..325e166 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -45,9 +45,8 @@ USER $PUID:$PGID ENV ROOT=/stable-diffusion RUN --mount=type=cache,target="$USER_HOME"/.cache/pip \ - cd ${ROOT} && \ git clone -b v0.3.10 --depth=1 https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \ - pip install -r requirements.txt + pip install -r ${ROOT}/requirements.txt RUN git clone -b 3.6.5 --depth=1 https://github.com/ltdrdata/ComfyUI-Manager ${ROOT}/custom_nodes/comfyui-manager && \ pip install -r ${ROOT}/custom_nodes/comfyui-manager/requirements.txt From 17f1c0ca11162fc5e967b4030619802061cdba43 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 9 Apr 2025 13:13:31 +0100 Subject: [PATCH 79/92] Create Docker-compose-build.yml this compose is to complete a local build --- Docker-compose-build.yml | 88 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Docker-compose-build.yml diff --git a/Docker-compose-build.yml b/Docker-compose-build.yml new file mode 100644 index 0000000..b58b9c7 --- /dev/null +++ b/Docker-compose-build.yml @@ -0,0 +1,88 @@ +x-base_service: &base_service + ports: + - "${WEBUI_PORT:-7860}:7860" + volumes: + - &v1 ./data:/data + - &v2 ./output:/output + stop_signal: SIGKILL + tty: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + device_ids: ['0'] + capabilities: [compute, utility] +name: webui-docker +services: + download: + build: ./services/download/ + profiles: ["download"] + volumes: + - *v1 + auto: &automatic + <<: *base_service + profiles: ["auto"] + build: ./services/AUTOMATIC1111 + image: sd-auto:80 + environment: + - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api + + auto-rocm: + <<: *base_service + profiles: ["auto-rocm"] + build: + context: ./services/AUTOMATIC1111 + dockerfile: Dockerfile.rocm + devices: + - "/dev/kfd" + - "/dev/dri" + deploy: {} + environment: + - CLI_ARGS=--allow-code --medvram --enable-insecure-extension-access --api + + reforge: &reforge + <<: *base_service + profiles: ["reforge"] + build: ./services/reforge + image: sd-reforge:80 + environment: + - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream + + forge: &forge + <<: *base_service + profiles: ["forge"] + build: ./services/forge + image: sd-forge:80 + environment: + - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream + + auto-cpu: + <<: *automatic + profiles: ["auto-cpu"] + deploy: {} + environment: + - CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api + + comfy: &comfy + <<: *base_service + profiles: ["comfy"] + build: ./services/comfy/ + image: sd-comfy:6 + environment: + - CLI_ARGS= + + comfy-cpu: + <<: *comfy + profiles: ["comfy-cpu"] + deploy: {} + environment: + - CLI_ARGS=--cpu + + fooocus: &fooocus + <<: *base_service + profiles: ["fooocus"] + build: ./services/fooocus/ + image: sd-fooocus:3 + environment: + - CLI_ARGS= From c0e97d1913989b350715ca956e224a33971784ec Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 9 Apr 2025 13:17:04 +0100 Subject: [PATCH 80/92] Update docker-compose.yml try using images rather than building. Should be quicker. --- docker-compose.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b58b9c7..098f7fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,8 +23,7 @@ services: auto: &automatic <<: *base_service profiles: ["auto"] - build: ./services/AUTOMATIC1111 - image: sd-auto:80 + image: simonmcnair/automatic1111:master environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api @@ -44,16 +43,14 @@ services: reforge: &reforge <<: *base_service profiles: ["reforge"] - build: ./services/reforge - image: sd-reforge:80 + image: simonmcnair/reforge:master environment: - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream forge: &forge <<: *base_service profiles: ["forge"] - build: ./services/forge - image: sd-forge:80 + image: simonmcnair/forge:master environment: - CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api --pin-shared-memory --cuda-malloc --cuda-stream @@ -67,8 +64,7 @@ services: comfy: &comfy <<: *base_service profiles: ["comfy"] - build: ./services/comfy/ - image: sd-comfy:6 + image: simonmcnair/comfy:master environment: - CLI_ARGS= @@ -82,7 +78,6 @@ services: fooocus: &fooocus <<: *base_service profiles: ["fooocus"] - build: ./services/fooocus/ - image: sd-fooocus:3 + image: simonmcnair/fooocus:master environment: - CLI_ARGS= From 45dd1ddbab5b3e5bab581e4eea7d884d4c38a5e3 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 9 Apr 2025 13:19:31 +0100 Subject: [PATCH 81/92] Update docker.yml add rocm and reforge --- .github/workflows/docker.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 665c9c0..a7c9f23 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -17,6 +17,10 @@ jobs: dockerfile: services/AUTOMATIC1111/Dockerfile context: services/AUTOMATIC1111/ + - image: simonmcnair/AUTOMATIC1111-rocm + dockerfile: services/AUTOMATIC1111/Dockerfile.rocm + context: services/AUTOMATIC1111/ + - image: simonmcnair/comfy dockerfile: services/comfy/Dockerfile context: services/comfy/ @@ -33,6 +37,10 @@ jobs: dockerfile: services/forge/Dockerfile context: services/forge/ + - image: simonmcnair/reforge + dockerfile: services/reforge/Dockerfile + context: services/reforge/ + runs-on: ubuntu-latest name: ${{ matrix.profile }} steps: From 72ffe451745ea2240dcd599712f4c90549aeb3a0 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 9 Apr 2025 13:22:24 +0100 Subject: [PATCH 82/92] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 098f7fd..6dda583 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ x-base_service: &base_service name: webui-docker services: download: - build: ./services/download/ + image: simonmcnair/download:master profiles: ["download"] volumes: - *v1 From 70858ae56fffe4a334bc3d39fa9a1f1119c34ddb Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 9 Apr 2025 13:23:57 +0100 Subject: [PATCH 83/92] Update docker-compose.yml --- docker-compose.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6dda583..b86c2e3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,9 +30,7 @@ services: auto-rocm: <<: *base_service profiles: ["auto-rocm"] - build: - context: ./services/AUTOMATIC1111 - dockerfile: Dockerfile.rocm + image: simonmcnair/automatic1111-rocm:master devices: - "/dev/kfd" - "/dev/dri" From 657ad995365ca39666368566e3bcd7fe1858a173 Mon Sep 17 00:00:00 2001 From: ExtraTNT <56388556+ExtraTNT@users.noreply.github.com> Date: Thu, 10 Apr 2025 08:44:54 +0200 Subject: [PATCH 84/92] fix docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b86c2e3..4acdfaa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api - auto-rocm: + auto-rocm: <<: *base_service profiles: ["auto-rocm"] image: simonmcnair/automatic1111-rocm:master From b959dcf21bf3f04081cf5f59eecb44d44e6715bd Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 5 May 2025 09:58:02 +0100 Subject: [PATCH 85/92] Update Dockerfile --- services/comfy/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index 325e166..839ba93 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -60,4 +60,6 @@ RUN chmod u+x /docker/entrypoint.sh && cp /docker/extra_model_paths.yaml ${ROOT} ENV NVIDIA_VISIBLE_DEVICES=all PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS="" EXPOSE 7860 ENTRYPOINT ["/docker/entrypoint.sh"] -CMD python -u main.py --listen --port 7860 ${CLI_ARGS} +#CMD python -u main.py --listen --port 7860 ${CLI_ARGS} +CMD sh -c "python3 -c 'import os; print(f\"Running as UID={os.getuid()}, GID={os.getgid()}\")' && python -u main.py --listen --port 7860 ${CLI_ARGS}" + From eed0ad0738230bac20ecac2c087059206d488af8 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Mon, 5 May 2025 10:02:02 +0100 Subject: [PATCH 86/92] Update entrypoint.sh --- services/comfy/entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/comfy/entrypoint.sh b/services/comfy/entrypoint.sh index f10eb66..3818002 100755 --- a/services/comfy/entrypoint.sh +++ b/services/comfy/entrypoint.sh @@ -28,6 +28,11 @@ if [ -f "/data/config/comfy/startup.sh" ]; then popd fi +# Only chown if not running as root (UID != 0) +if [ "$(id -u)" -ne 0 ]; then + chown -R "$(id -u):$(id -g)" ~ 2>/dev/null || true +fi + chown -R $PUID:$PGID ~/.cache/ chmod 776 ~/.cache/ From 6615a2cd3709b4ea64e3ad63ccd1272c50bbf0b5 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 7 May 2025 22:46:51 +0100 Subject: [PATCH 87/92] Update Docker-compose-build.yml oops --- Docker-compose-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docker-compose-build.yml b/Docker-compose-build.yml index b58b9c7..83073ea 100644 --- a/Docker-compose-build.yml +++ b/Docker-compose-build.yml @@ -28,7 +28,7 @@ services: environment: - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api - auto-rocm: + auto-rocm: <<: *base_service profiles: ["auto-rocm"] build: From d5fe95f9a6815aeead87a417fe21ae1f9a57c7fe Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 7 May 2025 22:48:50 +0100 Subject: [PATCH 88/92] Update Dockerfile.rocm --- services/AUTOMATIC1111/Dockerfile.rocm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/AUTOMATIC1111/Dockerfile.rocm b/services/AUTOMATIC1111/Dockerfile.rocm index 47a39c0..4014980 100644 --- a/services/AUTOMATIC1111/Dockerfile.rocm +++ b/services/AUTOMATIC1111/Dockerfile.rocm @@ -2,6 +2,8 @@ FROM alpine/git:2.36.2 as download COPY clone.sh /clone.sh +RUN rm -rf "/usr/local/share/boost" +RUN rm -rf "$AGENT_TOOLSDIRECTORY" RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf \ && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif From e30123a8937cf389203eee0d925cce71ba7601e9 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 7 May 2025 22:50:09 +0100 Subject: [PATCH 89/92] Update Dockerfile.rocm --- services/AUTOMATIC1111/Dockerfile.rocm | 1 + 1 file changed, 1 insertion(+) diff --git a/services/AUTOMATIC1111/Dockerfile.rocm b/services/AUTOMATIC1111/Dockerfile.rocm index 4014980..eab7fc1 100644 --- a/services/AUTOMATIC1111/Dockerfile.rocm +++ b/services/AUTOMATIC1111/Dockerfile.rocm @@ -15,6 +15,7 @@ RUN . /clone.sh BLIP https://github.com/salesforce/BLIP.git 48211a1594f1321b00f1 RUN . /clone.sh k-diffusion https://github.com/crowsonkb/k-diffusion.git ab527a9a6d347f364e3d185ba6d714e22d80cb3c RUN . /clone.sh clip-interrogator https://github.com/pharmapsychotic/clip-interrogator 2cf03aaf6e704197fd0dae7c7f96aa59cf1b11c9 RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-models 45c443b316737a4ab6e40413d7794a7f5657c19f +RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets 6f7db241d2f8ba7457bac5ca9753331f0c266917 FROM rocm/pytorch:rocm6.0.2_ubuntu22.04_py3.10_pytorch_2.1.2 From a024ec1cbc7c167e70d4ac05fdfd3b5d989016a0 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 7 May 2025 22:51:09 +0100 Subject: [PATCH 90/92] Update Dockerfile.rocm --- services/AUTOMATIC1111/Dockerfile.rocm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/AUTOMATIC1111/Dockerfile.rocm b/services/AUTOMATIC1111/Dockerfile.rocm index eab7fc1..b463fa2 100644 --- a/services/AUTOMATIC1111/Dockerfile.rocm +++ b/services/AUTOMATIC1111/Dockerfile.rocm @@ -27,7 +27,8 @@ RUN --mount=type=cache,target=/var/cache/apt \ # we need those apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ # extensions needs those - ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential libgoogle-perftools-dev && \ + apt-get clean RUN python -m pip install --upgrade pip wheel From 18ad18cd2a462a85b3d4604c5881e09e4dc6f203 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Wed, 7 May 2025 22:53:46 +0100 Subject: [PATCH 91/92] Update Dockerfile --- services/AUTOMATIC1111/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index 87d2fb6..d558c5d 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -5,8 +5,6 @@ COPY clone.sh /clone.sh RUN rm -rf "/usr/local/share/boost" RUN rm -rf "$AGENT_TOOLSDIRECTORY" -RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git 6f7db241d2f8ba7457bac5ca9753331f0c266917 - RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf \ && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif From d72392cd38f8c58674fabeba633f53db0f483307 Mon Sep 17 00:00:00 2001 From: simonmcnair <101189766+simonmcnair@users.noreply.github.com> Date: Thu, 8 May 2025 08:23:13 +0100 Subject: [PATCH 92/92] Update docker.yml see if this makes the build work --- .github/workflows/docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a7c9f23..5c06abb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -17,9 +17,9 @@ jobs: dockerfile: services/AUTOMATIC1111/Dockerfile context: services/AUTOMATIC1111/ - - image: simonmcnair/AUTOMATIC1111-rocm - dockerfile: services/AUTOMATIC1111/Dockerfile.rocm - context: services/AUTOMATIC1111/ + # - image: simonmcnair/AUTOMATIC1111-rocm + # dockerfile: services/AUTOMATIC1111/Dockerfile.rocm + # context: services/AUTOMATIC1111/ - image: simonmcnair/comfy dockerfile: services/comfy/Dockerfile