2022-09-05 17:51:22 +00:00
|
|
|
FROM alpine/git:2.36.2 as download
|
2022-09-18 11:49:06 +00:00
|
|
|
|
2023-04-16 08:32:03 +00:00
|
|
|
COPY clone.sh /clone.sh
|
2022-09-05 17:51:22 +00:00
|
|
|
|
2022-10-27 14:49:30 +00:00
|
|
|
RUN . /clone.sh taming-transformers https://github.com/CompVis/taming-transformers.git 24268930bf1dce879235a7fddd0b2355b84d7ea6 \
|
|
|
|
&& rm -rf data assets **/*.ipynb
|
|
|
|
|
2022-12-09 17:14:48 +00:00
|
|
|
RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git 47b6b607fdd31875c9279cd2f4f16b92e4ea958e \
|
2022-10-27 14:49:30 +00:00
|
|
|
&& rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif
|
|
|
|
|
|
|
|
RUN . /clone.sh CodeFormer https://github.com/sczhou/CodeFormer.git c5b4593074ba6214284d6acd5f1719b6c5d739af \
|
|
|
|
&& rm -rf assets inputs
|
|
|
|
|
|
|
|
RUN . /clone.sh BLIP https://github.com/salesforce/BLIP.git 48211a1594f1321b00f14c9f7a5b4813144b2fb9
|
2022-12-09 17:14:48 +00:00
|
|
|
RUN . /clone.sh k-diffusion https://github.com/crowsonkb/k-diffusion.git 5b3af030dd83e0297272d861c19477735d0317ec
|
2022-10-27 14:49:30 +00:00
|
|
|
RUN . /clone.sh clip-interrogator https://github.com/pharmapsychotic/clip-interrogator 2486589f24165c8e3b303f84e9dbbea318df83e8
|
2022-09-30 07:37:27 +00:00
|
|
|
|
2022-10-22 08:44:39 +00:00
|
|
|
|
2023-01-13 20:27:55 +00:00
|
|
|
FROM alpine:3.17 as xformers
|
|
|
|
RUN apk add --no-cache aria2
|
2023-02-17 08:22:34 +00:00
|
|
|
RUN aria2c -x 5 --dir / --out wheel.whl 'https://github.com/AbdBarho/stable-diffusion-webui-docker/releases/download/5.0.0/xformers-0.0.17.dev449-cp310-cp310-manylinux2014_x86_64.whl'
|
2022-09-11 03:25:45 +00:00
|
|
|
|
2023-01-13 20:27:55 +00:00
|
|
|
FROM python:3.10.9-slim
|
2022-09-05 17:51:22 +00:00
|
|
|
|
2022-12-26 08:50:29 +00:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1
|
2022-09-11 03:25:45 +00:00
|
|
|
|
2023-04-16 08:32:03 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
|
|
pip install torch==1.13.1+cu117 torchvision --extra-index-url https://download.pytorch.org/whl/cu117
|
2022-09-11 03:25:45 +00:00
|
|
|
|
2022-10-29 20:02:35 +00:00
|
|
|
RUN apt-get update && apt install fonts-dejavu-core rsync git jq moreutils -y && apt-get clean
|
2022-09-11 03:25:45 +00:00
|
|
|
|
2022-09-05 17:51:22 +00:00
|
|
|
|
2023-04-16 08:32:03 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
|
|
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && \
|
|
|
|
cd stable-diffusion-webui && \
|
|
|
|
git reset --hard d7aec59c4eb02f723b3d55c6f927a42e97acd679 && \
|
|
|
|
pip install -r requirements_versions.txt
|
2022-09-05 17:51:22 +00:00
|
|
|
|
2022-12-22 08:19:39 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
|
|
--mount=type=bind,from=xformers,source=/wheel.whl,target=/xformers-0.0.15-cp310-cp310-linux_x86_64.whl \
|
|
|
|
pip install triton /xformers-0.0.15-cp310-cp310-linux_x86_64.whl
|
2022-10-29 20:02:35 +00:00
|
|
|
|
|
|
|
ENV ROOT=/stable-diffusion-webui
|
2022-09-08 15:56:15 +00:00
|
|
|
|
2022-09-18 11:49:06 +00:00
|
|
|
|
2023-04-16 08:32:03 +00:00
|
|
|
COPY --from=download /repositories/ ${ROOT}/repositories/
|
2022-10-23 07:05:28 +00:00
|
|
|
RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/data/* ${ROOT}/interrogate
|
2022-12-17 11:22:45 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
|
|
pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt
|
2022-09-08 15:56:15 +00:00
|
|
|
|
2022-12-17 11:22:45 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
2023-02-02 18:53:48 +00:00
|
|
|
pip install pyngrok \
|
2022-11-13 06:12:17 +00:00
|
|
|
git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \
|
|
|
|
git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \
|
2023-01-18 17:48:34 +00:00
|
|
|
git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b
|
2022-11-13 06:12:17 +00:00
|
|
|
|
2022-09-07 17:45:03 +00:00
|
|
|
# Note: don't update the sha of previous versions because the install will take forever
|
|
|
|
# instead, update the repo state in a later step
|
2022-09-15 19:05:31 +00:00
|
|
|
|
2023-02-23 20:50:16 +00:00
|
|
|
# TODO: either remove if fixed in A1111 (unlikely) or move to the top with other apt stuff
|
|
|
|
RUN apt-get -y install libgoogle-perftools-dev && apt-get clean
|
|
|
|
ENV LD_PRELOAD=libtcmalloc.so
|
|
|
|
|
2023-03-14 17:30:08 +00:00
|
|
|
ARG SHA=a9fed7c364061ae6efb37f797b6b522cb3cf7aa2
|
2023-04-16 08:32:03 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
|
|
cd stable-diffusion-webui && \
|
|
|
|
git fetch && \
|
|
|
|
git reset --hard ${SHA} && \
|
|
|
|
pip install -r requirements_versions.txt
|
2022-09-05 17:51:22 +00:00
|
|
|
|
2023-02-17 08:22:34 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip pip install -U opencv-python-headless
|
2022-09-05 17:51:22 +00:00
|
|
|
|
|
|
|
COPY . /docker
|
2022-10-23 07:05:28 +00:00
|
|
|
|
2023-04-16 08:32:03 +00:00
|
|
|
RUN \
|
|
|
|
python3 /docker/info.py ${ROOT}/modules/ui.py && \
|
|
|
|
mv ${ROOT}/style.css ${ROOT}/user.css && \
|
|
|
|
# one of the ugliest hacks I ever wrote \
|
|
|
|
sed -i 's/in_app_dir = .*/in_app_dir = True/g' /usr/local/lib/python3.10/site-packages/gradio/routes.py
|
2022-09-11 18:18:50 +00:00
|
|
|
|
2022-11-20 10:05:39 +00:00
|
|
|
WORKDIR ${ROOT}
|
2023-04-16 08:32:03 +00:00
|
|
|
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
|
|
|
ENV NVIDIA_VISIBLE_DEVICES=all
|
2023-02-02 18:53:48 +00:00
|
|
|
ENV CLI_ARGS=""
|
2022-09-05 17:51:22 +00:00
|
|
|
EXPOSE 7860
|
2022-10-30 09:01:18 +00:00
|
|
|
ENTRYPOINT ["/docker/entrypoint.sh"]
|
2023-02-02 18:53:48 +00:00
|
|
|
CMD python -u webui.py --listen --port 7860 ${CLI_ARGS}
|