commit 72dc22fa22017ee4adfa1a7f463e89e8c0e9a5ff Author: Joseph Hanson Date: Thu Jul 18 09:00:03 2024 -0500 Initial diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0c23ca6 --- /dev/null +++ b/Dockerfile @@ -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} \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..5c59134 --- /dev/null +++ b/entrypoint.sh @@ -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 "$@" \ No newline at end of file diff --git a/extra_model_paths.yaml b/extra_model_paths.yaml new file mode 100644 index 0000000..15a96d3 --- /dev/null +++ b/extra_model_paths.yaml @@ -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 \ No newline at end of file