- Dockerfile +148 -0
Dockerfile
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Hugging Face's logo
|
2 |
+
Hugging Face
|
3 |
+
Search models, datasets, users...
|
4 |
+
Models
|
5 |
+
Datasets
|
6 |
+
Spaces
|
7 |
+
Docs
|
8 |
+
Solutions
|
9 |
+
Pricing
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
Hugging Face is way more fun with friends and colleagues! 🤗 Join an organization
|
14 |
+
Spaces:
|
15 |
+
|
16 |
+
baby123
|
17 |
+
/
|
18 |
+
sd Copied
|
19 |
+
like
|
20 |
+
0
|
21 |
+
App
|
22 |
+
Files and versions
|
23 |
+
Community
|
24 |
+
Settings
|
25 |
+
sd
|
26 |
+
/
|
27 |
+
dockerfile
|
28 |
+
baby123's picture
|
29 |
+
baby123
|
30 |
+
1
|
31 |
+
aad5ed6
|
32 |
+
9 minutes ago
|
33 |
+
raw
|
34 |
+
history
|
35 |
+
blame
|
36 |
+
edit
|
37 |
+
delete
|
38 |
+
No virus
|
39 |
+
5.06 kB
|
40 |
+
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
|
41 |
+
|
42 |
+
ENV DEBIAN_FRONTEND noninteractive
|
43 |
+
ENV PYTHONUNBUFFERED=1
|
44 |
+
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
|
45 |
+
ENV PIP_NO_CACHE_DIR=1
|
46 |
+
# OS setup
|
47 |
+
RUN apt-get update -y \
|
48 |
+
&& apt-get upgrade -y \
|
49 |
+
&& apt-get install -y \
|
50 |
+
libgl1 \
|
51 |
+
libglib2.0-0 \
|
52 |
+
curl \
|
53 |
+
vim \
|
54 |
+
wget \
|
55 |
+
git \
|
56 |
+
git-lfs \
|
57 |
+
tzdata \
|
58 |
+
bash \
|
59 |
+
ca-certificates \
|
60 |
+
libreadline8 \
|
61 |
+
bzip2 \
|
62 |
+
psmisc \
|
63 |
+
procps \
|
64 |
+
netbase \
|
65 |
+
openssh-client \
|
66 |
+
libsqlite3-dev \
|
67 |
+
python3-pip \
|
68 |
+
python3-venv \
|
69 |
+
python-is-python3 \
|
70 |
+
build-essential \
|
71 |
+
libssl-dev \
|
72 |
+
libffi-dev \
|
73 |
+
aria2 \
|
74 |
+
\
|
75 |
+
&& pip3 install --upgrade pip \
|
76 |
+
\
|
77 |
+
&& git lfs install \
|
78 |
+
\
|
79 |
+
&& apt-get clean autoclean \
|
80 |
+
&& apt-get autoremove --yes \
|
81 |
+
&& rm -rf /var/lib/apt/lists/*
|
82 |
+
# OS timezone setting (UTC)
|
83 |
+
RUN echo "UTC" > /etc/timezone
|
84 |
+
ENV TZ=UTC
|
85 |
+
# Poetry for Python packages
|
86 |
+
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/usr/local/poetry python3 - --yes \
|
87 |
+
&& ln -s /usr/local/poetry/bin/poetry /usr/bin/poetry \
|
88 |
+
\
|
89 |
+
&& poetry config virtualenvs.create false \
|
90 |
+
&& poetry config virtualenvs.in-project false
|
91 |
+
# Create non-root user
|
92 |
+
ENV ENV="/etc/profile"
|
93 |
+
RUN adduser --disabled-password --gecos '' user && \
|
94 |
+
mkdir -p /app && \
|
95 |
+
chown -R user:user /app && \
|
96 |
+
printf "\n. /etc/profile\n" >> /home/user/.profile \
|
97 |
+
printf "\n. /etc/profile\n" >> /home/user/.bashrc
|
98 |
+
# Sets up virtualenv for dependencies
|
99 |
+
ENV VIRTUAL_ENV="/opt/venv"
|
100 |
+
ENV VIRTUAL_ENV_DISABLE_PROMPT=1
|
101 |
+
ENV POETRY_ACTIVE=1
|
102 |
+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
103 |
+
RUN echo "export PATH=$PATH" >> /home/user/.bashrc \
|
104 |
+
&& python3 -m venv $VIRTUAL_ENV \
|
105 |
+
&& /opt/venv/bin/pip install --upgrade --no-cache-dir pip \
|
106 |
+
&& chown -R user:user /opt/venv
|
107 |
+
# Run as non-root user
|
108 |
+
USER user
|
109 |
+
WORKDIR /app
|
110 |
+
# Installation of basic Python dependencies specified in pyproject.toml
|
111 |
+
COPY --chown=user:user pyproject.toml poetry.lock /app/
|
112 |
+
RUN poetry install
|
113 |
+
# AUTOMATIC1111' WebUI
|
114 |
+
RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui /app/stable-diffusion-webui \
|
115 |
+
&& (cd /app/stable-diffusion-webui && git checkout 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8)
|
116 |
+
# Deforum extension
|
117 |
+
RUN git clone https://github.com/deforum-art/deforum-for-automatic1111-webui /app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui \
|
118 |
+
&& (cd /app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui && git checkout b60d999202f0fd2b386150d0938c43e639db8643)
|
119 |
+
# Images Browser WebUI extension
|
120 |
+
RUN git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser /app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser \
|
121 |
+
&& (cd /app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser && git checkout a42c7a30181636a05815e62426d5eff4d3340529)
|
122 |
+
# CiviTAI Browser WebUI extension
|
123 |
+
RUN git clone https://github.com/Vetchems/sd-civitai-browser /app/stable-diffusion-webui/extensions/sd-civitai-browser \
|
124 |
+
&& (cd /app/stable-diffusion-webui/extensions/sd-civitai-browser && git checkout b25a5daf7df3f6340d3e243d533228d8ade5288d)
|
125 |
+
# Additional Networks WebUI extension
|
126 |
+
RUN git clone https://github.com/kohya-ss/sd-webui-additional-networks /app/stable-diffusion-webui/extensions/sd-webui-additional-networks \
|
127 |
+
&& (cd /app/stable-diffusion-webui/extensions/sd-webui-additional-networks && git checkout 822f2136fa6d63b85663597b03ef3edafab01187) \
|
128 |
+
&& mkdir -p /app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/LoRA
|
129 |
+
# ControlNet WebUI extension
|
130 |
+
RUN git clone https://github.com/Mikubill/sd-webui-controlnet /app/stable-diffusion-webui/extensions/sd-webui-controlnet \
|
131 |
+
&& (cd /app/stable-diffusion-webui/extensions/sd-webui-controlnet && git checkout 5c74f300c3ac04323963af80dd2b971a7c2b2b29) \
|
132 |
+
&& mkdir -p /app/stable-diffusion-webui/models/ControlNet
|
133 |
+
# Prepare WebUI environment
|
134 |
+
WORKDIR /app/stable-diffusion-webui
|
135 |
+
RUN /opt/venv/bin/python launch.py --exit --skip-torch-cuda-test --xformers
|
136 |
+
# Patch WebUI
|
137 |
+
RUN sed -i -e 's/ show_progress=False,/ show_progress=True,/g' modules/ui.py
|
138 |
+
RUN sed -i -e 's/shared.demo.launch/shared.demo.queue().launch/g' webui.py
|
139 |
+
RUN sed -i -e 's/ outputs=\[/queue=False, &/g' modules/ui.py
|
140 |
+
RUN sed -i -e 's/ queue=False, / /g' modules/ui.py
|
141 |
+
# Copy startup scripts
|
142 |
+
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/
|
143 |
+
RUN chmod +x on_start.sh
|
144 |
+
|
145 |
+
EXPOSE 7860
|
146 |
+
|
147 |
+
CMD ["/opt/venv/bin/python", "run.py", "--listen", "--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"]
|
148 |
+
|