-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.invokeai
63 lines (51 loc) · 3.09 KB
/
Dockerfile.invokeai
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM nvidia/cuda:11.6.1-base-ubuntu20.04
SHELL ["/bin/bash", "-c"]
WORKDIR /root
RUN apt update \
&& apt install --no-install-recommends -y curl wget git libglib2.0-0 libgl1 build-essential fonts-dejavu \
&& apt-get clean
VOLUME /root/.cache
VOLUME /res
ENV PYTHONUNBUFFERED=1
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
EXPOSE 7860
ENV BASH_ENV=/etc/profile
ENV CONDA_DEFAULT_ENV=base
RUN mkdir ~/.conda \
&& wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.12.0-Linux-x86_64.sh -O ~/miniconda.sh -q \
&& mkdir -p /opt \
&& bash ~/miniconda.sh -b -p /opt/conda \
&& rm ~/miniconda.sh \
&& ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh \
&& echo ". /opt/conda/etc/profile.d/conda.sh" >> /etc/profile \
&& echo "conda activate \$CONDA_DEFAULT_ENV" >> /etc/profile \
&& echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc \
&& echo "conda activate \$CONDA_DEFAULT_ENV" >> ~/.bashrc \
&& find /opt/conda/ -follow -type f -name '*.a' -delete \
&& find /opt/conda/ -follow -type f -name '*.js.map' -delete \
&& /opt/conda/bin/conda clean -afy
ARG GIT_CHECKOUT=main
RUN git clone https://github.com/invoke-ai/InvokeAI.git stable-diffusion-webui \
&& cd stable-diffusion-webui \
&& git checkout $GIT_CHECKOUT \
&& ln -sf /root/stable-diffusion-webui/environments-and-requirements/environment-lin-cuda.yml environment.yml \
&& conda env update -n $CONDA_DEFAULT_ENV -f /root/stable-diffusion-webui/environment.yml
ENV INVOKEAI_ROOT=/root/stable-diffusion-webui
RUN mkdir -p /root/stable-diffusion-webui/models/ldm/stable-diffusion-v1 \
&& ln -s /res/sd-v1-4.ckpt /root/stable-diffusion-webui/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt \
&& ln -s /res/v1-5-pruned-emaonly.ckpt /root/stable-diffusion-webui/models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt \
&& ln -s /res/vae-ft-mse-840000-ema-pruned.ckpt /root/stable-diffusion-webui/models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt \
&& ln -s /res/sd-v1-5-inpainting.ckpt /root/stable-diffusion-webui/models/ldm/stable-diffusion-v1/sd-v1-5-inpainting.ckpt \
&& cp /root/stable-diffusion-webui/configs/models.yaml.example /root/stable-diffusion-webui/configs/models.yaml \
&& mkdir -p /root/stable-diffusion-webui/models/gfpgan \
&& ln -s /res/GFPGANv1.4.pth /root/stable-diffusion-webui/models/gfpgan/GFPGANv1.4.pth \
&& mkdir -p /root/stable-diffusion-webui/ldm/invoke/restoration/codeformer/weights \
&& ln -s /res/codeformer.pth /root/stable-diffusion-webui/ldm/invoke/restoration/codeformer/weights/codeformer.pth \
&& mkdir -p /root/stable-diffusion-webui/gfpgan/weights \
&& ln -s /res/detection_Resnet50_Final.pth /root/stable-diffusion-webui/gfpgan/weights/detection_Resnet50_Final.pth \
&& ln -s /res/parsing_parsenet.pth /root/stable-diffusion-webui/gfpgan/weights/parsing_parsenet.pth \
&& echo -e "#!/bin/bash\nset -e\n[ ! -f '/root/.invokeai' ] && python /root/stable-diffusion-webui/scripts/configure_invokeai.py --no-interactive && touch /root/.invokeai\nexec \"\$@\"" > /root/bootstrap.sh \
&& chmod +x /root/bootstrap.sh
WORKDIR /root/stable-diffusion-webui
ENTRYPOINT ["/root/bootstrap.sh"]