This commit is contained in:
Joseph Hanson 2024-07-18 09:00:03 -05:00
commit 72dc22fa22
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
3 changed files with 78 additions and 0 deletions

22
Dockerfile Normal file
View file

@ -0,0 +1,22 @@
FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime
ARG TAG_VERSION=v0.0.1
ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1
RUN apt-get update && apt-get install -y git && apt-get clean
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 ${TAG_VERSION} && \
pip install -r requirements.txt
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}

31
entrypoint.sh Normal file
View file

@ -0,0 +1,31 @@
#!/bin/bash
set -Eeuo pipefail
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"
for to_path in "${!MOUNTS[@]}"; do
set -Eeuo pipefail
from_path="${MOUNTS[${to_path}]}"
rm -rf "${to_path}"
if [ ! -f "$from_path" ]; then
mkdir -vp "$from_path"
fi
mkdir -vp "$(dirname "${to_path}")"
ln -sT "${from_path}" "${to_path}"
echo Mounted $(basename "${from_path}")
done
if [ -f "/data/config/comfy/startup.sh" ]; then
pushd ${ROOT}
. /data/config/comfy/startup.sh
popd
fi
exec "$@"

25
extra_model_paths.yaml Normal file
View file

@ -0,0 +1,25 @@
a111:
base_path: /data
checkpoints: models/Stable-diffusion
configs: models/Stable-diffusion
vae: models/VAE
loras: models/Lora
upscale_models: |
models/RealESRGAN
models/ESRGAN
models/SwinIR
models/GFPGAN
hypernetworks: models/hypernetworks
controlnet: models/ControlNet
gligen: models/GLIGEN
clip: models/CLIPEncoder
embeddings: embeddings
custom_nodes: config/comfy/custom_nodes
# TODO: I am unsure about these, need more testing
# style_models: config/comfy/style_models
# t2i_adapter: config/comfy/t2i_adapter
# clip_vision: config/comfy/clip_vision
# diffusers: config/comfy/diffusers