FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04 ENV DEBIAN_FRONTEND noninteractive ENV PYTHONUNBUFFERED=1 ENV PIP_DISABLE_PIP_VERSION_CHECK=1 ENV PIP_NO_CACHE_DIR=1 # OS setup RUN apt-get update -y \ && apt-get upgrade -y \ && apt-get install -y \ libgl1 \ libglib2.0-0 \ curl \ vim \ wget \ git \ git-lfs \ tzdata \ bash \ ca-certificates \ libreadline8 \ bzip2 \ psmisc \ procps \ netbase \ openssh-client \ libsqlite3-dev \ python3-pip \ python3-venv \ python-is-python3 \ build-essential \ libssl-dev \ libffi-dev \ aria2 \ && git lfs install \ && apt-get clean autoclean \ && apt-get autoremove --yes \ && rm -rf /var/lib/apt/lists/* # OS timezone setting (UTC) RUN echo "UTC" > /etc/timezone ENV TZ=UTC # Poetry for Python packages RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/usr/local/poetry python3 - --yes \ && ln -s /usr/local/poetry/bin/poetry /usr/bin/poetry \ \ && poetry config virtualenvs.create false \ && poetry config virtualenvs.in-project false # Create non-root user ENV ENV="/etc/profile" RUN adduser --disabled-password --gecos '' user && \ mkdir -p /app && \ chown -R user:user /app && \ printf "\n. /etc/profile\n" >> /home/user/.profile \ printf "\n. /etc/profile\n" >> /home/user/.bashrc # Sets up virtualenv for dependencies ENV VIRTUAL_ENV="/opt/venv" ENV VIRTUAL_ENV_DISABLE_PROMPT=1 ENV POETRY_ACTIVE=1 ENV PATH="$VIRTUAL_ENV/bin:$PATH" RUN echo "export PATH=$PATH" >> /home/user/.bashrc \ && python3 -m venv $VIRTUAL_ENV \ && /opt/venv/bin/pip install --upgrade --no-cache-dir pip \ && chown -R user:user /opt/venv # Run as non-root user USER user WORKDIR /app # Installation of basic Python dependencies specified in pyproject.toml COPY --chown=user:user pyproject.toml poetry.lock /app/ RUN poetry install # turn the detached message off RUN git config --global advice.detachedHead false # AUTOMATIC1111' WebUI RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui /app/stable-diffusion-webui \ && (cd /app/stable-diffusion-webui && git checkout 5ef669de080814067961f28357256e8fe27544f4) RUN pip3 install httpx==0.24.1 # Deforum extension #RUN git clone https://github.com/deforum-art/deforum-for-automatic1111-webui /app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui \ # && (cd /app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui && git checkout 8a6ee64c72c18c60d66a5758b84496bf27c52cda) # Images Browser WebUI extension RUN git clone https://github.com/AlUlkesh/stable-diffusion-webui-images-browser /app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser \ && (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser && git checkout b984cdd1692f46006333ab92ef463cc35879f455) # Locon extension (Obsolete - Use Lycrois) #RUN git clone https://github.com/KohakuBlueleaf/a1111-sd-webui-locon /app/stable-diffusion-webui/extensions/a1111-sd-webui-locon \ # && (cd /app/stable-diffusion-webui/extensions/a1111-sd-webui-locon && git checkout afe70b0f77f2d1cc691f297074cc049913711662) # Lycoris extension RUN git clone https://github.com/KohakuBlueleaf/a1111-sd-webui-lycoris /app/stable-diffusion-webui/extensions/a1111-sd-webui-lycoris \ && (cd /app/stable-diffusion-webui/extensions/a1111-sd-webui-lycoris && git checkout 8e97bf54867c25d00fc480be1ab4dae5399b35ef) # Local Latent Upscaler extension RUN git clone https://github.com/hnmr293/sd-webui-llul /app/stable-diffusion-webui/extensions/sd-webui-llul \ && (cd /app/stable-diffusion-webui/extensions/sd-webui-llul && git checkout b20337ae1091ea65fdaf7108a2eaac13fed078d5) # Aspect Ratios extension RUN git clone https://github.com/alemelis/sd-webui-ar /app/stable-diffusion-webui/extensions/sd-webui-ar \ && (cd /app/stable-diffusion-webui/extensions/sd-webui-ar && git checkout ce0a645ca2ad949573cacc7f5cd14ac13e83e2c9) # Stable Hoarde extension #RUN git clone https://github.com/natanjunges/stable-diffusion-webui-stable-horde /app/stable-diffusion-webui/extensions/stable-diffusion-webui-stable-horde \ # && (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-stable-horde && git checkout 00248b89bfab7ba465f104324a5d0708ad37341f) # After Detailer extension RUN git clone https://github.com/Bing-su/adetailer /app/stable-diffusion-webui/extensions/adetailer \ && (cd /app/stable-diffusion-webui/extensions/adetailer && git checkout a0b4c56eb75eceabf07f2ede28986a58cef2bebe) # Panorama extension #RUN git clone https://github.com/GeorgLegato/sd-webui-panorama-viewer /app/stable-diffusion-webui/extensions/sd-webui-panorama-viewer \ # && (cd /app/stable-diffusion-webui/extensions/sd-webui-panorama-viewer && git checkout 6879f2e00f4e21abffe66cd2f35e1a50efc4aba8) # Style Pile extension RUN git clone https://github.com/some9000/StylePile /app/stable-diffusion-webui/extensions/StylePile \ && (cd /app/stable-diffusion-webui/extensions/StylePile && git checkout 206b3d06bebb75df1a4b5439e35c432668ea7574) # Anti Burn extension #RUN git clone https://github.com/klimaleksus/stable-diffusion-webui-anti-burn /app/stable-diffusion-webui/extensions/stable-diffusion-webui-anti-burn \ # && (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-anti-burn && git checkout 4d678f1f1120415fe4cb9f77484252bc82af03b2) # Super Merger extension RUN git clone https://github.com/hako-mikan/sd-webui-supermerger /app/stable-diffusion-webui/extensions/sd-webui-supermerger \ && (cd /app/stable-diffusion-webui/extensions/sd-webui-supermerger && git checkout 665878f69f8287bd8d34cf388e8b1f2bf4468ab1) # UMI AI Extension #RUN git clone https://github.com/Klokinator/UnivAICharGen /app/stable-diffusion-webui/extensions/UnivAICharGen \ # && (cd /app/stable-diffusion-webui/extensions/UnivAICharGen && git checkout c2c6114a98a46085ee7e7eec7e09980c68ae43d0) #Embeddings Merge RUN git clone https://github.com/klimaleksus/stable-diffusion-webui-embedding-merge /app/stable-diffusion-webui/extensions/stable-diffusion-webui-embedding-merge \ && (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-embedding-merge && git checkout c3cdd9ac227e56dfff728d44799918787e5f7e66) # Wildcards Extension #RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards /app/stable-diffusion-webui/extensions/stable-diffusion-webui-wildcards \ # && (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-wildcards && git checkout c7d49e18398a95f2d13e2e4c063fe2f63fc2a432) # Dynamic Prompts extension RUN git clone https://github.com/adieyal/sd-dynamic-prompts /app/stable-diffusion-webui/extensions/sd-dynamic-prompts \ && (cd /app/stable-diffusion-webui/extensions/sd-dynamic-prompts && git checkout 2f36e0ff835ae0874faa3cfe90ed57eb76cef7ac) # CiviTAI BETTER Browser WebUI extension RUN git clone https://github.com/IAmXenos14/SDWebUI_CivitaiHelperUpdated /app/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper \ && (cd /app/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper && git checkout a5d6c493c8e00668b63e3ab924630d2ccc0a2c18) # CiviTAI WebUI extension RUN git clone https://github.com/civitai/sd_civitai_extension /app/stable-diffusion-webui/extensions/sd_civitai_extension \ && (cd /app/stable-diffusion-webui/extensions/sd_civitai_extension && git checkout 763e8aedfab68e8933c3efbfa568961beeaa3def) #Civitai Browser Plus RUN git clone https://github.com/BlafKing/sd-civitai-browser-plus /app/stable-diffusion-webui/extensions/sd-civitai-browser-plus \ && (cd /app/stable-diffusion-webui/extensions/sd-civitai-browser-plus && git checkout 035326f28dc1318273bc62dbb53cb37a7b4fa022) # Huggingface Push extension #RUN git clone https://github.com/camenduru/stable-diffusion-webui-huggingface /app/stable-diffusion-webui/extensions/stable-diffusion-webui-huggingface \ # && (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-huggingface && git checkout 6e824a1aeff9982e6068ec369dbaceb79c21a05a) # Booru Tag Autocomplete extension RUN git clone https://github.com/DominikDoom/a1111-sd-webui-tagcomplete /app/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete \ && (cd /app/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete && git checkout 5db035cc3ac5ba418abbbd49dc1d0112594a488a) # Batchlinks Downloader extension RUN git clone https://github.com/etherealxx/batchlinks-webui /app/stable-diffusion-webui/extensions/batchlinks-webui \ && (cd /app/stable-diffusion-webui/extensions/batchlinks-webui && git checkout d44bbb5e2a043f2eed80c3945c0f2c676e41d0e5) # Fast PNG Info extension #RUN git clone https://github.com/NoCrypt/sd-fast-pnginfo /app/stable-diffusion-webui/extensions/sd-fast-pnginfo \ # && (cd /app/stable-diffusion-webui/extensions/sd-fast-pnginfo && git checkout b6647cd57fd5930f4355dee253833a459d2b39fe) # Filer extension RUN git clone https://github.com/aka7774/sd_filer /app/stable-diffusion-webui/extensions/sd_filer \ && (cd /app/stable-diffusion-webui/extensions/sd_filer && git checkout ff7d76930ced048a4e5e73ca964551d679463da7) #AnimateDIFF RUN git clone https://github.com/continue-revolution/sd-webui-animatediff /app/stable-diffusion-webui/extensions/sd-webui-animatediff \ && (cd /app/stable-diffusion-webui/extensions/sd-webui-animatediff && git checkout ca9819779ba0a2659c5bcbec709c8eeabc677f08) # Paste extension RUN git clone https://github.com/klimaleksus/stable-diffusion-webui-fix-image-paste /app/stable-diffusion-webui/extensions/stable-diffusion-webui-fix-image-paste \ && (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-fix-image-paste && git checkout 2844e17e2806ed5bc76831b27f947909060d0aac) # Toolkit extension RUN git clone https://github.com/arenasys/stable-diffusion-webui-model-toolkit /app/stable-diffusion-webui/extensions/stable-diffusion-webui-model-toolkit \ && (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-model-toolkit && git checkout 4d8fea77dba5643439691c1c6b003db4d330ff0b) # Additional Networks WebUI extension RUN git clone https://github.com/kohya-ss/sd-webui-additional-networks /app/stable-diffusion-webui/extensions/sd-webui-additional-networks \ && (cd /app/stable-diffusion-webui/extensions/sd-webui-additional-networks && git checkout 86300421b0ff35ab9d670874e836b7f65b806430) #&& mkdir -p /app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/LoRA # ControlNet WebUI extension RUN git clone https://github.com/Mikubill/sd-webui-controlnet /app/stable-diffusion-webui/extensions/sd-webui-controlnet \ && (cd /app/stable-diffusion-webui/extensions/sd-webui-controlnet && git checkout e78d486ce0e5cb9adc52549370d71e0433bf2111) \ && mkdir -p /app/stable-diffusion-webui/models/ControlNet #Grab the Helper LoRas #RUN mkdir -p /app/stable-diffusion-webui/models/Lora && cd /app/stable-diffusion-webui/models/Lora \ # && (git clone https://huggingface.co/Xenos14/QoL-LoRas) # Grab the Embeddings, LoRa's, etc. RUN mkdir -p /app/holder && cd /app/holder \ && git clone https://huggingface.co/Xenos14/MyMods \ && cd MyMods \ && cp -r models /app/stable-diffusion-webui/ \ && cp -r embeddings /app/stable-diffusion-webui/ \ && cp -r extensions/Umi-AI-debloat/wildcards /app/stable-diffusion-webui/extensions/stable-diffusion-webui-wildcards/ # Prepare WebUI environment WORKDIR /app/stable-diffusion-webui RUN /opt/venv/bin/python launch.py --exit --skip-torch-cuda-test --xformers # Patch WebUI RUN sed -i -e 's/ show_progress=False,/ show_progress=True,/g' modules/ui.py RUN sed -i -e 's/shared.demo.launch/shared.demo.queue().launch/g' webui.py RUN sed -i -e 's/ outputs=\[/queue=False, &/g' modules/ui.py RUN sed -i -e 's/ queue=False, / /g' modules/ui.py # Copy startup scripts COPY --chown=user:user run.py on_start.sh config.json ui-config.json shared-config.json shared-ui-config.json header_patch.py /app/stable-diffusion-webui/ # COPY embeddings/ /app/stable-diffusion-webui/embeddings/ COPY styles.csv /app/stable-diffusion-webui/ RUN chmod +x on_start.sh EXPOSE 7860 #CMD ["/opt/venv/bin/python", "run.py", "--listen", "--gradio-queue", "--disable-nan-check", "--enable-insecure-extension-access", "--ui-config-file", "ui-config.json", "--ui-settings-file", "config.json", "--disable-console-progressbars", "--cors-allow-origins", "huggingface.co,hf.space", "--no-progressbar-hiding", "--enable-console-prompts", "--no-download-sd-model", "--api", "--skip-version-check", "--lora-dir", "/app/stable-diffusion-webui/models/Lora", "--embeddings-dir", "/app/stable-diffusion-webui/embeddings"] CMD ["/opt/venv/bin/python", "run.py", "--gradio-queue", "--precision", "full", "--no-half", "--no-half-vae", "--disable-safe-unpickle", "--disable-nan-check", "--enable-insecure-extension-access", "--ui-config-file", "ui-config.json", "--ui-settings-file", "config.json", "--disable-console-progressbars", "--cors-allow-origins", "huggingface.co,hf.space", "--no-progressbar-hiding", "--enable-console-prompts", "--no-download-sd-model", "--api", "--skip-version-check", "--lora-dir", "/app/stable-diffusion-webui/models/Lora", "--embeddings-dir", "/app/stable-diffusion-webui/embeddings"]