Dockerfile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # syntax=docker/dockerfile:1
  2. FROM continuumio/miniconda3:4.12.0
  3. SHELL ["/bin/bash", "-ceuxo", "pipefail"]
  4. ENV DEBIAN_FRONTEND=noninteractive
  5. RUN conda install python=3.8.5 && conda clean -a -y
  6. RUN conda install pytorch==1.11.0 torchvision==0.12.0 cudatoolkit=11.3 -c pytorch && conda clean -a -y
  7. RUN apt-get update && apt install fonts-dejavu-core rsync gcc -y && apt-get clean
  8. RUN <<EOF
  9. git config --global http.postBuffer 1048576000
  10. git clone https://github.com/sd-webui/stable-diffusion-webui.git stable-diffusion
  11. cd stable-diffusion
  12. git reset --hard 1a9c053cb7b6832695771db2555c0adc9b41e95f
  13. conda env update --file environment.yaml -n base
  14. conda clean -a -y
  15. EOF
  16. ARG BRANCH=dev SHA=2215a3b40325ac53d65c22e181eb59ef22ff0586
  17. RUN <<EOF
  18. cd stable-diffusion
  19. git fetch
  20. git checkout ${BRANCH}
  21. git reset --hard ${SHA}
  22. conda env update --file environment.yaml -n base
  23. conda clean -a -y
  24. EOF
  25. # add info
  26. COPY . /docker/
  27. RUN python /docker/info.py /stable-diffusion/frontend/frontend.py && chmod +x /docker/mount.sh
  28. WORKDIR /stable-diffusion
  29. ENV PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS=""
  30. EXPOSE 7860
  31. CMD /docker/mount.sh && \
  32. python3 -u scripts/webui.py --outdir /output --ckpt /data/StableDiffusion/model.ckpt ${CLI_ARGS}
  33. # sed -i -- 's/8501/7860/g' .streamlit/config.toml && STREAMLIT_SERVER_HEADLESS=true python -u -m streamlit run scripts/webui_streamlit.py --theme.base dark