36 lines
1.3 KiB
Docker
36 lines
1.3 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/comfyanonymous/ComfyUI.git /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 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 \
|
||
|
&& /app/env/bin/pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm${ROCM_VERSION} \
|
||
|
&& /app/env/bin/pip install --no-cache-dir -r requirements.txt
|
||
|
|
||
|
VOLUME ["/app/models/loras", "/app/models/checkpoints", "/app/models/vae", "/app/models/embeddings"]
|
||
|
VOLUME ["/app/outputs"]
|
||
|
|
||
|
EXPOSE 8188
|
||
|
ENV PYTORCH_CUDA_ALLOC_CONF="garbage_collection_threshold:0.9,max_split_size_mb:512"
|
||
|
ENTRYPOINT ["/app/env/bin/python", "main.py", "--listen"]
|
||
|
CMD []
|