Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +109 -35
Dockerfile
CHANGED
@@ -1,51 +1,125 @@
|
|
1 |
|
2 |
-
|
3 |
|
4 |
-
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.7.1/ubuntu2204/devel/cudnn8/Dockerfile
|
5 |
-
FROM nvidia/cuda:11.7.1-base-ubuntu22.04
|
6 |
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
|
|
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
RUN
|
13 |
-
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
RUN
|
19 |
-
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
RUN sed -i -e '/settings_interface, \"Settings\", \"settings\"/d' /content/stable-diffusion-webui/modules/ui.py
|
30 |
-
RUN sed -i -e "s/document.getElementsByTagName('gradio-app')\[0\].shadowRoot/!!document.getElementsByTagName('gradio-app')[0].shadowRoot ? document.getElementsByTagName('gradio-app')[0].shadowRoot : document/g" /content/stable-diffusion-webui/script.js
|
31 |
-
RUN sed -i -e 's/ show_progress=False,/ show_progress=True,/g' /content/stable-diffusion-webui/modules/ui.py
|
32 |
-
RUN sed -i -e 's/default_enabled=False/default_enabled=True/g' /content/stable-diffusion-webui/webui.py
|
33 |
-
RUN sed -i -e 's/ outputs=\[/queue=False, &/g' /content/stable-diffusion-webui/modules/ui.py
|
34 |
-
RUN sed -i -e 's/ queue=False, / /g' /content/stable-diffusion-webui/modules/ui.py
|
35 |
|
36 |
-
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
|
|
40 |
|
41 |
-
|
42 |
-
|
|
|
43 |
|
44 |
-
|
45 |
-
RUN
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
EXPOSE 7860
|
50 |
|
51 |
-
CMD
|
|
|
1 |
|
2 |
+
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
|
3 |
|
|
|
|
|
4 |
ENV DEBIAN_FRONTEND noninteractive
|
5 |
+
ENV PYTHONUNBUFFERED=1
|
6 |
+
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
|
7 |
+
ENV PIP_NO_CACHE_DIR=1
|
8 |
|
9 |
+
# OS setup
|
10 |
+
RUN apt-get update -y \
|
11 |
+
&& apt-get upgrade -y \
|
12 |
+
&& apt-get install -y \
|
13 |
+
libgl1 \
|
14 |
+
libglib2.0-0 \
|
15 |
+
curl \
|
16 |
+
vim \
|
17 |
+
wget \
|
18 |
+
git \
|
19 |
+
git-lfs \
|
20 |
+
tzdata \
|
21 |
+
bash \
|
22 |
+
ca-certificates \
|
23 |
+
libreadline8 \
|
24 |
+
bzip2 \
|
25 |
+
psmisc \
|
26 |
+
procps \
|
27 |
+
netbase \
|
28 |
+
openssh-client \
|
29 |
+
libsqlite3-dev \
|
30 |
+
python3-pip \
|
31 |
+
python3-venv \
|
32 |
+
python-is-python3 \
|
33 |
+
build-essential \
|
34 |
+
libssl-dev \
|
35 |
+
libffi-dev \
|
36 |
+
aria2 \
|
37 |
+
\
|
38 |
+
&& pip3 install --upgrade pip \
|
39 |
+
\
|
40 |
+
&& git lfs install \
|
41 |
+
\
|
42 |
+
&& apt-get clean autoclean \
|
43 |
+
&& apt-get autoremove --yes \
|
44 |
+
&& rm -rf /var/lib/apt/lists/*
|
45 |
|
46 |
+
# OS timezone setting (UTC)
|
47 |
+
RUN echo "UTC" > /etc/timezone
|
48 |
+
ENV TZ=UTC
|
49 |
|
50 |
+
# Poetry for Python packages
|
51 |
+
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/usr/local/poetry python3 - --yes \
|
52 |
+
&& ln -s /usr/local/poetry/bin/poetry /usr/bin/poetry \
|
53 |
+
\
|
54 |
+
&& poetry config virtualenvs.create false \
|
55 |
+
&& poetry config virtualenvs.in-project false
|
56 |
|
57 |
+
# Create non-root user
|
58 |
+
ENV ENV="/etc/profile"
|
59 |
+
RUN adduser --disabled-password --gecos '' user && \
|
60 |
+
mkdir -p /app && \
|
61 |
+
chown -R user:user /app && \
|
62 |
+
printf "\n. /etc/profile\n" >> /home/user/.profile \
|
63 |
+
printf "\n. /etc/profile\n" >> /home/user/.bashrc
|
64 |
|
65 |
+
# Sets up virtualenv for dependencies
|
66 |
+
ENV VIRTUAL_ENV="/opt/venv"
|
67 |
+
ENV VIRTUAL_ENV_DISABLE_PROMPT=1
|
68 |
+
ENV POETRY_ACTIVE=1
|
69 |
+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
70 |
+
RUN echo "export PATH=$PATH" >> /home/user/.bashrc \
|
71 |
+
&& python3 -m venv $VIRTUAL_ENV \
|
72 |
+
&& /opt/venv/bin/pip install --upgrade --no-cache-dir pip \
|
73 |
+
&& chown -R user:user /opt/venv
|
74 |
|
75 |
+
# Run as non-root user
|
76 |
+
USER user
|
77 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
+
# Installation of basic Python dependencies specified in pyproject.toml
|
80 |
+
COPY --chown=user:user pyproject.toml poetry.lock /app/
|
81 |
+
RUN poetry install
|
82 |
|
83 |
+
# AUTOMATIC1111' WebUI
|
84 |
+
RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui /app/stable-diffusion-webui \
|
85 |
+
&& (cd /app/stable-diffusion-webui && git checkout a9fed7c364061ae6efb37f797b6b522cb3cf7aa2)
|
86 |
|
87 |
+
# Deforum extension
|
88 |
+
RUN git clone https://github.com/deforum-art/deforum-for-automatic1111-webui /app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui \
|
89 |
+
&& (cd /app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui && git checkout 2366bfdb47c226df0d14e712445414e459febad3)
|
90 |
|
91 |
+
# Images Browser WebUI extension
|
92 |
+
RUN git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser /app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser \
|
93 |
+
&& (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser && git checkout a42c7a30181636a05815e62426d5eff4d3340529)
|
94 |
+
|
95 |
+
# CiviTAI Browser WebUI extension
|
96 |
+
RUN git clone https://github.com/Vetchems/sd-civitai-browser /app/stable-diffusion-webui/extensions/sd-civitai-browser \
|
97 |
+
&& (cd /app/stable-diffusion-webui/extensions/sd-civitai-browser && git checkout b25a5daf7df3f6340d3e243d533228d8ade5288d)
|
98 |
+
|
99 |
+
# Additional Networks WebUI extension
|
100 |
+
RUN git clone https://github.com/kohya-ss/sd-webui-additional-networks /app/stable-diffusion-webui/extensions/sd-webui-additional-networks \
|
101 |
+
&& (cd /app/stable-diffusion-webui/extensions/sd-webui-additional-networks && git checkout d2758b6c8e2e8e956865a87b31fd74d3d7c010cb) \
|
102 |
+
&& mkdir -p /app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/LoRA
|
103 |
+
|
104 |
+
# ControlNet WebUI extension
|
105 |
+
RUN git clone https://github.com/Mikubill/sd-webui-controlnet /app/stable-diffusion-webui/extensions/sd-webui-controlnet \
|
106 |
+
&& (cd /app/stable-diffusion-webui/extensions/sd-webui-controlnet && git checkout 274dd5df217a03e059e9cf052447aece81bbd1cf) \
|
107 |
+
&& mkdir -p /app/stable-diffusion-webui/models/ControlNet
|
108 |
+
|
109 |
+
# Prepare WebUI environment
|
110 |
+
WORKDIR /app/stable-diffusion-webui
|
111 |
+
RUN /opt/venv/bin/python launch.py --exit --skip-torch-cuda-test --xformers
|
112 |
+
|
113 |
+
# Patch WebUI
|
114 |
+
RUN sed -i -e 's/ show_progress=False,/ show_progress=True,/g' modules/ui.py
|
115 |
+
RUN sed -i -e 's/shared.demo.launch/shared.demo.queue().launch/g' webui.py
|
116 |
+
RUN sed -i -e 's/ outputs=\[/queue=False, &/g' modules/ui.py
|
117 |
+
RUN sed -i -e 's/ queue=False, / /g' modules/ui.py
|
118 |
+
|
119 |
+
# Copy startup scripts
|
120 |
+
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/
|
121 |
+
RUN chmod +x on_start.sh
|
122 |
|
123 |
EXPOSE 7860
|
124 |
|
125 |
+
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"]
|