XenoEngine-SD-webui / Dockerfile
Xenos14's picture
Update Dockerfile
bb38116
raw
history blame
11.3 kB
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 \
\
&& pip3 install --upgrade pip \
\
&& 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
# AUTOMATIC1111' WebUI
RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui /app/stable-diffusion-webui \
&& (cd /app/stable-diffusion-webui && git checkout 68f336bd994bed5442ad95bad6b6ad5564a5409a)
# 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 b60d999202f0fd2b386150d0938c43e639db8643)
# 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 a71f0e2bf6a04648e270996e69fef1f746c15c62)
# 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)
# 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 45b21373c00097546694aaee4f29b3d1514f76c3)
# CiviTAI BETTER Browser WebUI extension
RUN git clone https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper /app/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper \
&& (cd /app/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper && git checkout 920ca3267f789a72e3225c99f069bf0be0db795d)
# 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 7ab4e9f384221500e1873405b12ae965d241e048)
# 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 1cb4fc8f2572545418fe988edd8815a20e6b0e28)
# 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)
# 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 /app/stable-diffusion-webui/
# 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"]