File size: 5,017 Bytes
7f96bde ca468f6 7f96bde 3d31e1a 7f96bde 3d31e1a 7f96bde 3d31e1a 7f96bde 3d31e1a 7f96bde 3d31e1a 57d969e 83d9d48 57d969e 7f96bde 3d31e1a 7f96bde ca468f6 6316350 2adf290 ca468f6 6316350 2adf290 ca468f6 6316350 ca468f6 6316350 ca468f6 6316350 2adf290 717e9d9 ca468f6 7f96bde 2adf290 7f96bde b8d8718 3c0d614 7f96bde a50c640 bb5b380 a50c640 bb5b380 d5868ac b5f887d d5868ac 7f96bde 42192c2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
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 a9fed7c364061ae6efb37f797b6b522cb3cf7aa2)
# 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 2366bfdb47c226df0d14e712445414e459febad3)
# Images Browser WebUI extension
RUN git clone https://github.com/yfszzx/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 a42c7a30181636a05815e62426d5eff4d3340529)
# CiviTAI Browser WebUI extension
RUN git clone https://github.com/Vetchems/sd-civitai-browser /app/stable-diffusion-webui/extensions/sd-civitai-browser \
&& (cd /app/stable-diffusion-webui/extensions/sd-civitai-browser && git checkout b25a5daf7df3f6340d3e243d533228d8ade5288d)
# 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 d2758b6c8e2e8e956865a87b31fd74d3d7c010cb) \
&& 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 274dd5df217a03e059e9cf052447aece81bbd1cf) \
&& mkdir -p /app/stable-diffusion-webui/models/ControlNet
# 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/
RUN chmod +x on_start.sh
EXPOSE 7860
CMD ["/opt/venv/bin/python", "run.py", "--listen", "--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"]
|