2022-09-11 20:36:09 +00:00
|
|
|
FROM debian
|
2022-09-11 14:47:54 +00:00
|
|
|
|
|
|
|
ARG gsd
|
|
|
|
ENV GITHUB_STABLE_DIFFUSION $gsd
|
2022-09-11 20:36:09 +00:00
|
|
|
|
2022-09-16 23:35:50 +00:00
|
|
|
ARG rsd
|
|
|
|
ENV REQS $rsd
|
2022-09-11 14:47:54 +00:00
|
|
|
|
2022-09-16 23:35:50 +00:00
|
|
|
ARG cs
|
|
|
|
ENV CONDA_SUBDIR $cs
|
2022-09-11 20:36:09 +00:00
|
|
|
|
2022-09-16 23:35:50 +00:00
|
|
|
ENV PIP_EXISTS_ACTION="w"
|
2022-09-11 14:47:54 +00:00
|
|
|
|
2022-09-11 16:03:33 +00:00
|
|
|
# TODO: Optimize image size
|
|
|
|
|
2022-09-11 14:47:54 +00:00
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
|
2022-09-16 23:35:50 +00:00
|
|
|
WORKDIR /
|
2022-09-11 14:47:54 +00:00
|
|
|
RUN apt update && apt upgrade -y \
|
|
|
|
&& apt install -y \
|
|
|
|
git \
|
2022-09-16 23:35:50 +00:00
|
|
|
libgl1-mesa-glx \
|
|
|
|
libglib2.0-0 \
|
2022-09-11 14:47:54 +00:00
|
|
|
pip \
|
|
|
|
python3 \
|
2022-09-16 23:35:50 +00:00
|
|
|
&& git clone $GITHUB_STABLE_DIFFUSION
|
2022-09-11 14:47:54 +00:00
|
|
|
|
2022-09-16 23:35:50 +00:00
|
|
|
# Install Anaconda or Miniconda
|
|
|
|
COPY anaconda.sh .
|
2022-09-11 14:47:54 +00:00
|
|
|
RUN bash anaconda.sh -b -u -p /anaconda && /anaconda/bin/conda init bash
|
|
|
|
|
2022-09-16 23:35:50 +00:00
|
|
|
# SD
|
2022-09-11 14:47:54 +00:00
|
|
|
WORKDIR /stable-diffusion
|
2022-09-16 23:35:50 +00:00
|
|
|
RUN source ~/.bashrc \
|
|
|
|
&& conda create -y --name ldm && conda activate ldm \
|
|
|
|
&& conda config --env --set subdir $CONDA_SUBDIR \
|
|
|
|
&& pip3 install -r $REQS \
|
|
|
|
&& pip3 install basicsr facexlib realesrgan \
|
|
|
|
&& mkdir models/ldm/stable-diffusion-v1 \
|
|
|
|
&& ln -s "/data/sd-v1-4.ckpt" models/ldm/stable-diffusion-v1/model.ckpt
|
|
|
|
|
|
|
|
# Face restoreation
|
2022-09-11 16:03:33 +00:00
|
|
|
# by default expected in a sibling directory to stable-diffusion
|
2022-09-16 23:35:50 +00:00
|
|
|
WORKDIR /
|
2022-09-11 14:47:54 +00:00
|
|
|
RUN git clone https://github.com/TencentARC/GFPGAN.git
|
|
|
|
|
|
|
|
WORKDIR /GFPGAN
|
2022-09-16 23:35:50 +00:00
|
|
|
RUN pip3 install -r requirements.txt \
|
2022-09-11 14:47:54 +00:00
|
|
|
&& python3 setup.py develop \
|
2022-09-16 23:35:50 +00:00
|
|
|
&& ln -s "/data/GFPGANv1.3.pth" experiments/pretrained_models/GFPGANv1.3.pth
|
2022-09-11 14:47:54 +00:00
|
|
|
|
|
|
|
WORKDIR /stable-diffusion
|
|
|
|
RUN python3 scripts/preload_models.py
|
|
|
|
|
2022-09-16 23:35:50 +00:00
|
|
|
WORKDIR /
|
|
|
|
COPY entrypoint.sh .
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|