Dockerfile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. FROM alpine:3.17 as xformers
  2. RUN apk add --no-cache aria2
  3. RUN aria2c -x 5 --dir / --out wheel.whl 'https://github.com/AbdBarho/stable-diffusion-webui-docker/releases/download/6.0.0/xformers-0.0.21.dev544-cp310-cp310-manylinux2014_x86_64-pytorch201.whl'
  4. FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
  5. ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1
  6. RUN apt-get update && apt-get install -y git && apt-get clean
  7. ENV ROOT=/stable-diffusion
  8. RUN --mount=type=cache,target=/root/.cache/pip \
  9. git clone https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \
  10. cd ${ROOT} && \
  11. git checkout master && \
  12. git reset --hard 884ea653c8d6fe19b3724f45a04a0d74cd881f2f && \
  13. pip install -r requirements.txt
  14. RUN --mount=type=cache,target=/root/.cache/pip \
  15. --mount=type=bind,from=xformers,source=/wheel.whl,target=/xformers-0.0.21-cp310-cp310-linux_x86_64.whl \
  16. pip install /xformers-0.0.21-cp310-cp310-linux_x86_64.whl
  17. WORKDIR ${ROOT}
  18. ARG BRANCH=master SHA=8607c2d42d10b0108de02528e813cc703e58813f
  19. RUN --mount=type=cache,target=/root/.cache/pip \
  20. git fetch && \
  21. git checkout ${BRANCH} && \
  22. git reset --hard ${SHA} && \
  23. pip install -r requirements.txt
  24. # add info
  25. COPY . /docker/
  26. RUN cp /docker/extra_model_paths.yaml ${ROOT}
  27. ENV NVIDIA_VISIBLE_DEVICES=all
  28. ENV PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS=""
  29. EXPOSE 7860
  30. ENTRYPOINT ["/docker/entrypoint.sh"]
  31. CMD python -u main.py --listen --port 7860 ${CLI_ARGS}