2022-09-05 17:51:22 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
2022-11-20 10:35:56 +00:00
|
|
|
FROM python:3.10-slim
|
2022-09-05 17:51:22 +00:00
|
|
|
SHELL ["/bin/bash", "-ceuxo", "pipefail"]
|
|
|
|
|
2022-12-09 15:50:46 +00:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive PIP_EXISTS_ACTION=w PIP_PREFER_BINARY=1
|
2022-09-11 18:18:50 +00:00
|
|
|
|
2022-09-05 17:51:22 +00:00
|
|
|
|
2022-12-09 15:50:46 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
|
|
pip install torch==1.12.0+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
|
2022-11-20 10:35:56 +00:00
|
|
|
|
|
|
|
RUN apt-get update && apt-get install git -y && apt-get clean
|
|
|
|
|
|
|
|
RUN git clone https://github.com/invoke-ai/InvokeAI.git /stable-diffusion
|
|
|
|
|
|
|
|
WORKDIR /stable-diffusion
|
2022-09-05 17:51:22 +00:00
|
|
|
|
2022-12-09 15:50:46 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip <<EOF
|
2022-12-03 12:36:18 +00:00
|
|
|
git reset --hard 5c31feb3a1096d437c94b6e1c3224eb7a7224a85
|
2022-10-07 07:46:07 +00:00
|
|
|
git config --global http.postBuffer 1048576000
|
2022-12-03 12:36:18 +00:00
|
|
|
pip install -r binary_installer/py3.10-linux-x86_64-cuda-reqs.txt
|
2022-09-05 17:51:22 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
|
2022-12-03 12:36:18 +00:00
|
|
|
# patch match:
|
|
|
|
# https://github.com/invoke-ai/InvokeAI/blob/main/docs/installation/INSTALL_PATCHMATCH.md
|
|
|
|
RUN <<EOF
|
|
|
|
apt-get update
|
|
|
|
# apt-get install build-essential python3-opencv libopencv-dev -y
|
|
|
|
apt-get install make g++ libopencv-dev -y
|
|
|
|
apt-get clean
|
|
|
|
cd /usr/lib/x86_64-linux-gnu/pkgconfig/
|
|
|
|
ln -sf opencv4.pc opencv.pc
|
|
|
|
EOF
|
|
|
|
|
2023-01-07 17:58:50 +00:00
|
|
|
ARG BRANCH=main SHA=26e413ae9cf8dc04c617ca451a91a1624bfdf0c0
|
2022-12-09 15:50:46 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip <<EOF
|
2022-09-16 14:40:20 +00:00
|
|
|
git fetch
|
2022-09-19 20:02:46 +00:00
|
|
|
git reset --hard
|
2022-09-16 14:40:20 +00:00
|
|
|
git checkout ${BRANCH}
|
|
|
|
git reset --hard ${SHA}
|
2022-12-03 12:36:18 +00:00
|
|
|
pip install -r binary_installer/py3.10-linux-x86_64-cuda-reqs.txt
|
2022-09-16 14:40:20 +00:00
|
|
|
EOF
|
|
|
|
|
2022-12-09 15:50:46 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
2023-01-01 15:46:41 +00:00
|
|
|
pip install -U --force-reinstall opencv-python-headless huggingface_hub && \
|
|
|
|
python3 -c "from patchmatch import patch_match"
|
2022-12-03 12:36:18 +00:00
|
|
|
|
2022-09-16 14:40:20 +00:00
|
|
|
|
2023-01-01 15:46:41 +00:00
|
|
|
RUN touch invokeai.init
|
2022-09-16 14:40:20 +00:00
|
|
|
COPY . /docker/
|
2022-09-19 20:02:46 +00:00
|
|
|
|
2022-09-05 17:51:22 +00:00
|
|
|
|
2022-12-03 12:36:18 +00:00
|
|
|
ENV ROOT=/stable-diffusion PYTHONPATH="${PYTHONPATH}:${ROOT}" PRELOAD=false CLI_ARGS=""
|
2022-09-05 17:51:22 +00:00
|
|
|
EXPOSE 7860
|
2022-09-16 14:40:20 +00:00
|
|
|
|
2022-11-04 21:35:44 +00:00
|
|
|
ENTRYPOINT ["/docker/entrypoint.sh"]
|
2022-12-04 10:00:28 +00:00
|
|
|
CMD python3 -u scripts/invoke.py --web --host 0.0.0.0 --port 7860 --config /docker/models.yaml --root_dir ${ROOT} --outdir /output/invoke ${CLI_ARGS}
|