From 52d8aa379dea9679d786eb1c5a1a57e69572c4d2 Mon Sep 17 00:00:00 2001 From: cyntachs Date: Sat, 12 Aug 2023 17:23:08 -0400 Subject: [PATCH] Add changes from alpha2 --- Dockerfile | 22 ++++++++++------------ docker-compose.yml | 4 ++-- entrypoint.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 2419550..1720a5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,17 @@ FROM pytorch/pytorch:latest -ENV NVIDIA_VISIBLE_DEVICES=all -ENV PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS="" +RUN apt update && apt install git python3-pip -y && apt clean -RUN apt update && apt install git python3-pip libsm6 libxext6 -y && apt clean +RUN mkdir /docker +COPY . /docker/ +RUN chmod u+x /docker/entrypoint.sh ENV ROOT=/stable-diffusion -RUN git clone https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \ - cd ${ROOT} && \ - pip install -r requirements.txt - -WORKDIR ${ROOT} - -RUN cd ./custom_nodes && \ - git clone https://github.com/ltdrdata/ComfyUI-Manager.git +RUN mkdir ${ROOT} +ENV NVIDIA_VISIBLE_DEVICES=all +ENV PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS="" EXPOSE 5555 -CMD python -u main.py --listen --port 5555 ${CLI_ARGS} \ No newline at end of file +ENTRYPOINT [ "sh" , "/docker/entrypoint.sh" ] +WORKDIR ${ROOT} +RUN python -u main.py --listen --port 5555 ${CLI_ARGS} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1612def..a5f09fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: ports: - ${PORT}:5555 volumes: - - ${VOLUME}:/stable-diffusion + - ${COMFY_VOLUME}:/stable-diffusion environment: - CLI_ARGS= deploy: @@ -18,5 +18,5 @@ services: reservations: devices: - driver: nvidia - count: all + device_ids: ['0'] capabilities: [compute, utility] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..6b2f399 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +cd / + +if [ ! -f "/stable-diffusion/.installed" ]; then + echo "Installing ComfyUI..." + git clone https://github.com/comfyanonymous/ComfyUI.git /stable-diffusion + cd /stable-diffusion + pip install -r requirements.txt + + cd /stable-diffusion/custom_nodes + + echo "Installing ComfyUI Manager..." + git clone https://github.com/ltdrdata/ComfyUI-Manager.git + + cd / + + touch /stable-diffusion/.installed +else + echo "Updating ComfyUI..." + cd /stable-diffusion + + git fetch https://github.com/comfyanonymous/ComfyUI.git + git pull +fi; + +echo "Starting ComfyUI..." \ No newline at end of file