From d8f6dccc04d2358ed051f065767117b0cc0eaa23 Mon Sep 17 00:00:00 2001 From: Jan Grewe <jan@faked.org> Date: Wed, 7 Jun 2023 18:39:17 +0200 Subject: [PATCH] update to AUTOMATIC111 v1.3.2 and remove the Vlad version --- Dockerfile.automatic1111 => Dockerfile | 4 +-- Dockerfile.vlad | 24 ---------------- README.md | 38 +++++++++++--------------- 3 files changed, 18 insertions(+), 48 deletions(-) rename Dockerfile.automatic1111 => Dockerfile (95%) delete mode 100644 Dockerfile.vlad diff --git a/Dockerfile.automatic1111 b/Dockerfile similarity index 95% rename from Dockerfile.automatic1111 rename to Dockerfile index cdc08d1..dfb767d 100644 --- a/Dockerfile.automatic1111 +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM nvidia/cuda:11.8.0-base-ubuntu22.04 ARG VERSION -ENV VERSION=1.2.1 +ENV VERSION=1.3.2 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get -qq update -y \ @@ -14,11 +14,11 @@ RUN git clone --depth 1 --branch v${VERSION} -c advice.detachedHead=false \ WORKDIR /app +ENV PIP_NO_CACHE_DIR=true ENV PIP_ROOT_USER_ACTION=ignore RUN sed -i -e 's/ start()/ #start()/g' /app/launch.py \ && python launch.py --skip-torch-cuda-test \ && sed -i -e 's/ #start()/ start()/g' /app/launch.py -RUN rm -r /root/.cache/pip EXPOSE 7860 diff --git a/Dockerfile.vlad b/Dockerfile.vlad deleted file mode 100644 index 6d364e3..0000000 --- a/Dockerfile.vlad +++ /dev/null @@ -1,24 +0,0 @@ -FROM nvidia/cuda:11.8.0-base-ubuntu22.04 - -ARG VERSION -ENV VERSION=master - -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get -qq update -y \ - && apt-get -qq install -y --no-install-recommends \ - git git-lfs libgl1 pkg-config python-is-python3 python3-dev python3-pip \ - && rm -rf /var/lib/apt/lists/* - -RUN git clone --depth 1 --branch ${VERSION} -c advice.detachedHead=false \ - https://github.com/vladmandic/automatic.git /app - -WORKDIR /app - -ENV TORCH_COMMAND="torch torchaudio torchvision --index-url https://download.pytorch.org/whl/cu118" -ENV PIP_ROOT_USER_ACTION=ignore -RUN python installer.py -RUN rm -r /root/.cache/pip - -EXPOSE 7860 - -ENTRYPOINT ["python", "launch.py", "--listen", "--data-dir", "/app/data"] diff --git a/README.md b/README.md index 1ce3b94..e56bf77 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,41 @@ # Stable Diffusion WebUI in Docker -## Available Versions -Set the version of the Docker image you want to build: +This builds a Docker image containing the Stable Diffusion WebUI by AUTOMATIC111 from https://github.com/AUTOMATIC1111/stable-diffusion-webui -#### AUTOMATIC1111: -To build the Stable Diffusion WebUI by AUTOMATIC111 from https://github.com/AUTOMATIC1111/stable-diffusion-webui +## Build the image (and optionally push it to your registry) +Set the version and image name to use: ``` -export IMAGE_VERSION="automatic1111" +export VERSION="1.3.2" +export IMAGE_NAME=registry.example.com/stable-diffusion-webui ``` -#### Vlad -To build the Stable Diffusion WebUI by Vlad Mandic from https://github.com/vladmandic/automatic/ +Build the image and also add the `latest` tag: ``` -export IMAGE_VERSION="vlad" +docker build --build-arg VERSION=${VERSION} -t ${IMAGE_NAME}:${VERSION} . +docker tag ${IMAGE_NAME}:${VERSION} ${IMAGE_NAME}:latest ``` - -## Build the image (and optionally push it to your registry) +Optionally, push both tags to your registry: ``` -export IMAGE_NAME=registry.example.com/stable-diffusion-webui:${IMAGE_VERSION} -docker build -f Dockerfile.${IMAGE_VERSION} -t ${IMAGE_NAME} . -docker push ${IMAGE_NAME} +docker push ${IMAGE_NAME}:${VERSION} +docker push ${IMAGE_NAME}:latest ``` ## Run the container Run the image without retaining any data or outputs on exit: ``` -docker run --gpus all --rm --name stable-diffusion -p 7860:7860 ${IMAGE_NAME} +docker run --gpus all --rm --name stable-diffusion -p 7860:7860 ${IMAGE_NAME}:latest ``` Run the image with persisted models, downloaded data and outputs: ``` -docker run --tty --gpus all --rm --name stable-diffusion -p 7860:7860 \ - -v /storage/stable-diffusion/data/${IMAGE_VERSION}:/app/data \ +docker run --tty --gpus all --rm --name stable-diffusion-webui -p 7860:7860 \ + -v /storage/stable-diffusion/data/:/app/data \ -v /storage/stable-diffusion/repositories:/app/repositories \ -v /storage/stable-diffusion/cache:/root/.cache \ -v /storage/stable-diffusion/outputs:/app/outputs \ - ${IMAGE_NAME} + ${IMAGE_NAME}:latest ``` # Troubleshooting -* There is no output to the console when starting the AUTOMATIC1111 image until you generate an image. +* There is no output to the console when starting the image until you generate an image. This can be fixed by adding the `--tty` argument after `docker run` -* The Vlad image asks you to confirm the download of the default model if it doesn't find one (e.g. because you mounted an empty data directory, or ran the image without a mounted data directory). - If that happens, the container will exit with an error, as you can't confirm the download. - To fix this, run the container with the `--interactive` argument after `docker run`, then you can confirm the download. - If you are using a moounted data directory, this should only be necessary for the first run, as it will find the downloaded model the next time you start the image. -- GitLab