From a5218b86390d3c31de445aa969d6eb4ba04584a2 Mon Sep 17 00:00:00 2001 From: AbdBarho Date: Sun, 30 Oct 2022 10:01:18 +0100 Subject: [PATCH] Auto Extensions (#176) Closes #148 Closes #172 --- .devscripts/chmod.sh | 2 +- docker-compose.yml | 2 +- services/AUTOMATIC1111/Dockerfile | 6 +++--- services/AUTOMATIC1111/{mount.sh => entrypoint.sh} | 11 +++++++++++ 4 files changed, 16 insertions(+), 5 deletions(-) rename services/AUTOMATIC1111/{mount.sh => entrypoint.sh} (89%) diff --git a/.devscripts/chmod.sh b/.devscripts/chmod.sh index d4af583..d925b42 100755 --- a/.devscripts/chmod.sh +++ b/.devscripts/chmod.sh @@ -2,4 +2,4 @@ set -Eeuo pipefail -find . -name "*.sh" -exec git update-index --chmod=+x {} \; +find services -name "*.sh" -exec git update-index --chmod=+x {} \; diff --git a/docker-compose.yml b/docker-compose.yml index 76fbbcb..1e1a694 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: <<: *base_service profiles: ["auto"] build: ./services/AUTOMATIC1111 - image: sd-auto:6 + image: sd-auto:7 environment: - CLI_ARGS=--allow-code --medvram --xformers diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index f2def3b..a27f303 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -80,11 +80,11 @@ RUN pip install opencv-python-headless \ COPY . /docker -RUN chmod +x /docker/mount.sh && python3 /docker/info.py ${ROOT}/modules/ui.py +RUN chmod +x /docker/entrypoint.sh && python3 /docker/info.py ${ROOT}/modules/ui.py WORKDIR ${ROOT}/repositories/stable-diffusion ENV CLI_ARGS="" EXPOSE 7860 +ENTRYPOINT ["/docker/entrypoint.sh"] # run, -u to not buffer stdout / stderr -CMD /docker/mount.sh && \ - python3 -u ../../webui.py --listen --port 7860 --ckpt-dir ${ROOT}/models/Stable-diffusion --theme dark ${CLI_ARGS} +CMD python3 -u ../../webui.py --listen --port 7860 --ckpt-dir ${ROOT}/models/Stable-diffusion --theme dark ${CLI_ARGS} diff --git a/services/AUTOMATIC1111/mount.sh b/services/AUTOMATIC1111/entrypoint.sh similarity index 89% rename from services/AUTOMATIC1111/mount.sh rename to services/AUTOMATIC1111/entrypoint.sh index 82dda83..781e737 100755 --- a/services/AUTOMATIC1111/mount.sh +++ b/services/AUTOMATIC1111/entrypoint.sh @@ -2,6 +2,7 @@ set -Eeuo pipefail +# TODO: move all mkdir -p ? mkdir -p /data/config/auto/scripts/ cp -n /docker/config.json /data/config/auto/config.json jq '. * input' /data/config/auto/config.json /docker/config.json | sponge /data/config/auto/config.json @@ -32,6 +33,7 @@ MOUNTS["${ROOT}/models/hypernetworks"]="/data/Hypernetworks" MOUNTS["${ROOT}/embeddings"]="/data/embeddings" MOUNTS["${ROOT}/config.json"]="/data/config/auto/config.json" MOUNTS["${ROOT}/ui-config.json"]="/data/config/auto/ui-config.json" +MOUNTS["${ROOT}/extensions"]="/data/config/auto/extensions" # extra hacks MOUNTS["${ROOT}/repositories/CodeFormer/weights/facelib"]="/data/.cache" @@ -49,3 +51,12 @@ for to_path in "${!MOUNTS[@]}"; do done mkdir -p /output/saved /output/txt2img-images/ /output/img2img-images /output/extras-images/ /output/grids/ /output/txt2img-grids/ /output/img2img-grids/ + +if [ -f "/data/config/auto/startup.sh" ]; then + pushd ${ROOT} + . /data/config/auto/startup.sh + popd +fi + + +exec "$@"