-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.amotile
81 lines (68 loc) · 3.69 KB
/
Dockerfile.amotile
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
FROM nvidia/cuda:11.3.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
RUN conda install python=3.10.6 -c conda-forge \
&& conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
ARG GIT_CHECKOUT=master
ARG AUTOMATIC1111_CHECKOUT=master
ARG AMOTILE_BACKEND_CHECKOUT=master
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
&& apt update \
&& apt install --no-install-recommends -y supervisor nodejs \
&& apt-get clean
RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git \
&& cd stable-diffusion-webui \
&& git checkout $AUTOMATIC1111_CHECKOUT \
&& COMMANDLINE_ARGS="--exit --skip-torch-cuda-test" python launch.py \
&& git clone https://github.com/Hafiidz/latent-diffusion.git repositories/latent-diffusion \
&& cd repositories/latent-diffusion \
&& git checkout abf33e7002d59d9085081bce93ec798dcabd49af \
&& cd /root \
&& git clone https://github.com/amotile/stable-diffusion-studio.git \
&& git clone https://github.com/amotile/stable-diffusion-backend.git \
&& cd /root/stable-diffusion-studio \
&& git checkout $GIT_CHECKOUT \
&& npm install \
&& npm run build \
&& cd /root/stable-diffusion-backend \
&& git checkout $AMOTILE_BACKEND_CHECKOUT \
&& npm install \
&& cp src/process/implementations/automatic1111_scripts/*.py /root/stable-diffusion-webui/scripts/ \
&& rm -rf frontend &>/dev/null || true \
&& ln -s /root/stable-diffusion-studio/build/ frontend
RUN ln -s /res/target-model.ckpt /root/stable-diffusion-webui/models/Stable-diffusion/sd-v1-4.ckpt \
&& ln -s /res/GFPGANv1.3.pth /root/stable-diffusion-webui/GFPGANv1.3.pth \
&& ln -s /res/GFPGANv1.4.pth /root/stable-diffusion-webui/GFPGANv1.4.pth \
&& mkdir -p /root/stable-diffusion-webui/models/LDSR \
&& ln -s /res/LDSR.ckpt /root/stable-diffusion-webui/models/LDSR/model.ckpt \
&& ln -s /res/LDSR.yaml /root/stable-diffusion-webui/models/LDSR/project.yaml \
&& mkdir -p /root/stable-diffusion-webui/models/SwinIR \
&& ln -s /res/SwinIR_4x.pth /root/stable-diffusion-webui/models/SwinIR/SwinIR_4x.pth \
&& echo -e "[supervisord]\nnodaemon=true\nuser=root\n" > /etc/supervisor/supervisord.conf \
&& echo -e "[program:automatic1111]\ncommand=python launch.py\ndirectory=/root/stable-diffusion-webui\nautorestart=true\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stdout\nstderr_logfile_maxbytes=0\n" >> /etc/supervisor/supervisord.conf \
&& echo -e "[program:amotile-backend]\ncommand=npm start\ndirectory=/root/stable-diffusion-backend\nautorestart=true\nstartretries=99\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stdout\nstderr_logfile_maxbytes=0\n" >> /etc/supervisor/supervisord.conf
WORKDIR /root