This commit is contained in:
Brian Gebel 2025-04-28 13:05:02 -07:00
parent 73b2e33326
commit 85645ae66c
3 changed files with 22 additions and 23 deletions

View file

@ -1,28 +1,26 @@
FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime
ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1
ENV DEBIAN_FRONTEND=noninteractive
ENV PIP_PREFER_BINARY=1
ENV APPLICATION_ROOT=/stable-diffusion
ENV NVIDIA_VISIBLE_DEVICES=all
ENV PYTHONPATH="${PYTHONPATH}:${PWD}"
ENV CLI_ARGS=""
RUN apt-get update && apt-get install -y git && apt-get clean
RUN apt-get update && \
apt-get install -y git && \
apt-get clean && \
git clone --branch v0.3.19 --depth 1 https://github.com/comfyanonymous/ComfyUI.git ${APPLICATION_ROOT}
# Set USER here? https://stackoverflow.com/questions/24549746/switching-users-inside-docker-image-to-a-non-root-user
# USER ${uid}:${gid}
WORKDIR ${APPLICATION_ROOT}
# RUN --mount=type=cache,target=/root/.cache/pip \
# put Cache somehwere else or don't define target?
# PIP_CACHE_DIR pip cache dir
COPY . .
ENV ROOT=/stable-diffusion
RUN --mount=type=cache,target=/root/.cache/pip \
git clone https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \
cd ${ROOT} && \
git checkout v0.3.19 && \
pip install -r requirements.txt
pip install -r requirements.txt && \
chmod u+x ./entrypoint.sh
WORKDIR ${ROOT}
COPY . /docker/
RUN chmod u+x /docker/entrypoint.sh && cp /docker/extra_model_paths.yaml ${ROOT}
ENV NVIDIA_VISIBLE_DEVICES=all PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS=""
EXPOSE 7860
ENTRYPOINT ["/docker/entrypoint.sh"]
CMD python -u main.py --listen --port 7860 ${CLI_ARGS}
ENTRYPOINT ["./entrypoint.sh"]
CMD python -u main.py --listen --port 7860 ${CLI_ARGS}

View file

@ -6,9 +6,9 @@ mkdir -vp /data/config/comfy/custom_nodes
declare -A MOUNTS
MOUNTS["/root/.cache"]="/data/.cache"
MOUNTS["${ROOT}/input"]="/data/config/comfy/input"
MOUNTS["${ROOT}/output"]="/output/comfy"
# MOUNTS["/root/.cache"]="/data/.cache" # Determine why the original author decided to do this.
MOUNTS["${APPLICATION_ROOT}/input"]="/data/config/comfy/input"
MOUNTS["${APPLICATION_ROOT}/output"]="/output/comfy"
for to_path in "${!MOUNTS[@]}"; do
set -Eeuo pipefail
@ -23,7 +23,7 @@ for to_path in "${!MOUNTS[@]}"; do
done
if [ -f "/data/config/comfy/startup.sh" ]; then
pushd ${ROOT}
pushd ${APPLICATION_ROOT}
. /data/config/comfy/startup.sh
popd
fi

View file

@ -16,6 +16,7 @@ a111:
clip: models/CLIPEncoder
embeddings: embeddings
# This isn't a real value as far as I can tell?
custom_nodes: config/comfy/custom_nodes
# TODO: I am unsure about these, need more testing