|
| 1 | +FROM alpine/git:2.36.2 as download |
| 2 | + |
| 3 | +COPY clone.sh /clone.sh |
| 4 | + |
| 5 | +RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git 6f7db241d2f8ba7457bac5ca9753331f0c266917 |
| 6 | + |
| 7 | +RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf \ |
| 8 | + && rm -rf assets data/**/*.png data/**/*.jpg data/**/*.gif |
| 9 | + |
| 10 | +RUN . /clone.sh BLIP https://github.com/salesforce/BLIP.git 48211a1594f1321b00f14c9f7a5b4813144b2fb9 |
| 11 | +RUN . /clone.sh k-diffusion https://github.com/crowsonkb/k-diffusion.git ab527a9a6d347f364e3d185ba6d714e22d80cb3c |
| 12 | +RUN . /clone.sh clip-interrogator https://github.com/pharmapsychotic/clip-interrogator 2cf03aaf6e704197fd0dae7c7f96aa59cf1b11c9 |
| 13 | +RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-models 45c443b316737a4ab6e40413d7794a7f5657c19f |
| 14 | +RUN . /clone.sh huggingface_guess https://github.com/lllyasviel/huggingface_guess.git 70942022b6bcd17d941c1b4172804175758618e2 |
| 15 | +RUN . /clone.sh google_blockly_prototypes https://github.com/lllyasviel/google_blockly_prototypes.git 1e98997c7fedaf5106af9849b6f50ebe5c4408f1 |
| 16 | +RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git 6f7db241d2f8ba7457bac5ca9753331f0c266917 |
| 17 | + |
| 18 | + |
| 19 | +FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime |
| 20 | + |
| 21 | +ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 |
| 22 | + |
| 23 | +RUN --mount=type=cache,target=/var/cache/apt \ |
| 24 | + apt-get update && \ |
| 25 | + # we need those |
| 26 | + apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 \ |
| 27 | + # extensions needs those |
| 28 | + ffmpeg libglfw3-dev libgles2-mesa-dev pkg-config libcairo2 libcairo2-dev build-essential |
| 29 | + |
| 30 | + |
| 31 | +ENV ROOT=/stable-diffusion-webui-forge |
| 32 | + |
| 33 | +WORKDIR / |
| 34 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 35 | + git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git && \ |
| 36 | + cd $ROOT && \ |
| 37 | + pip install -r requirements_versions.txt |
| 38 | + |
| 39 | +RUN pip install -U typing_extensions |
| 40 | + |
| 41 | +COPY --from=download /repositories/ ${ROOT}/repositories/ |
| 42 | +RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/clip_interrogator/data/* ${ROOT}/interrogate |
| 43 | + |
| 44 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 45 | + pip install pyngrok xformers==0.0.27 \ |
| 46 | + git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \ |
| 47 | + git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \ |
| 48 | + git+https://github.com/mlfoundations/open_clip.git@v2.20.0 |
| 49 | + |
| 50 | +# there seems to be a memory leak (or maybe just memory not being freed fast enough) that is fixed by this version of malloc |
| 51 | +# maybe move this up to the dependencies list. |
| 52 | +RUN apt-get -y install libgoogle-perftools-dev && apt-get clean |
| 53 | +ENV LD_PRELOAD=libtcmalloc.so |
| 54 | + |
| 55 | +COPY . /docker |
| 56 | + |
| 57 | +RUN \ |
| 58 | + # mv ${ROOT}/style.css ${ROOT}/user.css && \ |
| 59 | + # one of the ugliest hacks I ever wrote \ |
| 60 | + sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && \ |
| 61 | + git config --global --add safe.directory '*' |
| 62 | + |
| 63 | +WORKDIR ${ROOT} |
| 64 | +ENV NVIDIA_VISIBLE_DEVICES=all |
| 65 | +ENV CLI_ARGS="" |
| 66 | +EXPOSE 7860 |
| 67 | +ENTRYPOINT ["/docker/entrypoint.sh"] |
| 68 | +CMD python -u webui.py --listen --port 7860 ${CLI_ARGS} |
0 commit comments