Falln87 commited on
Commit
8be560d
·
verified ·
1 Parent(s): 410a981

Create Dockerfile

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