Dockerfile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # syntax=docker/dockerfile:1
  2. FROM continuumio/miniconda3:4.12.0
  3. SHELL ["/bin/bash", "-ceuxo", "pipefail"]
  4. ENV DEBIAN_FRONTEND=noninteractive
  5. # now it requires python3.9
  6. RUN conda install python=3.9 && conda clean -a -y
  7. RUN conda install pytorch==1.11.0 torchvision==0.12.0 cudatoolkit=11.3 -c pytorch && conda clean -a -y
  8. RUN apt-get update && apt install fonts-dejavu-core rsync gcc -y && apt-get clean
  9. ENV PIP_EXISTS_ACTION=w
  10. RUN <<EOF
  11. git clone https://github.com/invoke-ai/InvokeAI.git stable-diffusion
  12. cd stable-diffusion
  13. git reset --hard 79e79b78aaeedb49afcc795e0e00eebfdbedee96
  14. git config --global http.postBuffer 1048576000
  15. conda env update --file environment.yml -n base
  16. conda clean -a -y
  17. EOF
  18. ARG BRANCH=main SHA=79e79b78aaeedb49afcc795e0e00eebfdbedee96
  19. RUN <<EOF
  20. cd stable-diffusion
  21. git fetch
  22. git reset --hard
  23. git checkout ${BRANCH}
  24. git reset --hard ${SHA}
  25. conda env update --file environment.yml -n base
  26. conda clean -a -y
  27. EOF
  28. RUN pip uninstall opencv-python -y && pip install --prefer-binary --force-reinstall --no-cache-dir opencv-python-headless
  29. COPY . /docker/
  30. RUN <<EOF
  31. python3 /docker/info.py /stable-diffusion/frontend/dist/index.html
  32. chmod +x /docker/mount.sh
  33. EOF
  34. ENV PRELOAD=false CLI_ARGS=""
  35. WORKDIR /stable-diffusion
  36. EXPOSE 7860
  37. CMD /docker/mount.sh && \
  38. python3 -u scripts/invoke.py --outdir /output --web --host 0.0.0.0 --port 7860 ${CLI_ARGS}