1
0
Fork 0
local-diffusion/stable-diffusion-webui-forge/Dockerfile

45 lines
1.6 KiB
Docker

ARG PYTHON_VERSION=3.10
ARG ROCM_VERSION=6.1
# we do not use rocm/pytorch as it currently use python 3.7 and we require >=python 3.10
FROM rocm/rocm-terminal:${ROCM_VERSION}
ARG PYTHON_VERSION
ARG ROCM_VERSION
# switch to root for setup
USER root
RUN git clone https://github.com/lllyasviel/stable-diffusion-webui-forge /app
WORKDIR /app
RUN apt update \
&& apt upgrade -y \
&& apt install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt update \
&& apt install -y pciutils bc mesa-utils google-perftools \
&& apt install -y python${PYTHON_VERSION}-full \
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
&& chown -R 1000:1000 /app \
&& rm -rf /var/lib/apt/lists/*
# switch back to unpreviledged user
USER 1000
RUN python${PYTHON_VERSION} -m venv /app/env \
&& sed -i'' -Ee "s/rocm[0-9]\.[0-9]/rocm${ROCM_VERSION}/g" webui.sh \
&& /app/env/bin/python -m pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm${ROCM_VERSION} \
&& /app/env/bin/python -m pip install --no-cache-dir -r requirements_versions.txt
VOLUME ["/app/models/Lora", "/app/models/Stable-diffusion", "/app/models/VAE"]
VOLUME ["/app/embeddings"]
VOLUME ["/app/extensions"]
VOLUME ["/app/repositories"]
VOLUME ["/app/outputs"]
VOLUME ["/app/log/images"]
EXPOSE 7860
ENV python_cmd=/app/env/bin/python
ENV PYTORCH_CUDA_ALLOC_CONF="garbage_collection_threshold:0.9,max_split_size_mb:512"
ENV COMMANDLINE_ARGS="--listen --enable-insecure-extension-access --theme=dark --api --update-check"
ENTRYPOINT ["./webui.sh"]
CMD []