From ccdb18ea7d4d60288f4f1f8642f696a93ed971d2 Mon Sep 17 00:00:00 2001 From: John | Elite Encoder Date: Tue, 23 Dec 2025 21:26:10 +0000 Subject: [PATCH 1/3] cleanup(docker): Update comfyui-base to allow specifying alternate entrypoint. Update .dockerignore to reduce image size - Added a new entrypoint script `byoc-entrypoint.sh` to streamline the execution of the BYOC server. - Updated the Dockerfile to copy the new entrypoint script and set appropriate permissions. - Expanded `.dockerignore` to exclude additional cache and build artifacts for cleaner Docker images. --- .dockerignore | 16 ++++++++++++++++ docker/Dockerfile.base | 8 +++++--- docker/byoc-entrypoint.sh | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 docker/byoc-entrypoint.sh diff --git a/.dockerignore b/.dockerignore index 9bb4397a..dbf267bd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,21 @@ **/__pycache__ **/*.py[cod] +.pytest_cache/ +.mypy_cache/ +.ruff_cache/ +.cache/ +.coverage +.hypothesis/ +.benchmarks/ +*.log +*.tgz +*.tar.gz +*.zip +dist/ +build/ +pip-wheel-metadata/ +*.egg-info/ +node_modules/ .env .git/ .venv/ diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index 4172e977..a692fa72 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -90,6 +90,8 @@ RUN conda run -n comfystream --cwd /workspace/comfystream --no-capture-output pi COPY ./workflows/comfyui/* /workspace/ComfyUI/user/default/workflows/ COPY ./test/example-512x512.png /workspace/ComfyUI/input COPY ./docker/entrypoint.sh /workspace/comfystream/docker/entrypoint.sh +COPY ./docker/byoc-entrypoint.sh /usr/local/bin/byoc-entrypoint.sh +RUN chmod +x /usr/local/bin/byoc-entrypoint.sh # Install ComfyUI requirements RUN conda run -n comfystream --no-capture-output --cwd /workspace/ComfyUI pip install -r requirements.txt --constraint /workspace/comfystream/src/comfystream/scripts/constraints.txt --root-user-action=ignore @@ -118,7 +120,7 @@ RUN echo "conda activate comfystream" >> ~/.bashrc WORKDIR /workspace/comfystream -# Run ComfyStream BYOC server from /workspace/ComfyUI within the comfystream conda env -ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "comfystream", "--cwd", "/workspace/ComfyUI", "python", "/workspace/comfystream/server/byoc.py"] -# Default args; can be overridden/appended at runtime +# Run ComfyStream BYOC server by default but allow overriding the command +ENTRYPOINT ["/usr/local/bin/byoc-entrypoint.sh"] +# Default args; can be overridden/appended at runtime or replaced entirely CMD ["--workspace", "/workspace/ComfyUI", "--host", "0.0.0.0", "--port", "8000"] diff --git a/docker/byoc-entrypoint.sh b/docker/byoc-entrypoint.sh new file mode 100644 index 00000000..9a384664 --- /dev/null +++ b/docker/byoc-entrypoint.sh @@ -0,0 +1,18 @@ +3#!/usr/bin/env bash + +set -e + +DEFAULT_CMD=(python /workspace/comfystream/server/byoc.py) + +# Allow `--` to separate entrypoint flags from the command +if [[ "${1:-}" == "--" ]]; then + shift +fi + +# If no args or first arg is an option, run the BYOC server with default args. +if [[ $# -eq 0 || "$1" == -* ]]; then + set -- "${DEFAULT_CMD[@]}" "$@" +fi + +exec conda run --no-capture-output -n comfystream --cwd /workspace/ComfyUI "$@" + From 28b01c320d8220a5fa169cc40d8e8eb3f791d6f7 Mon Sep 17 00:00:00 2001 From: John | Elite Encoder Date: Wed, 24 Dec 2025 00:56:24 -0500 Subject: [PATCH 2/3] fix stray Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docker/byoc-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/byoc-entrypoint.sh b/docker/byoc-entrypoint.sh index 9a384664..757e9f03 100644 --- a/docker/byoc-entrypoint.sh +++ b/docker/byoc-entrypoint.sh @@ -1,4 +1,4 @@ -3#!/usr/bin/env bash +#!/usr/bin/env bash set -e From 5caddbbf8b6d99908450e681138a94bd3b5d764d Mon Sep 17 00:00:00 2001 From: John | Elite Encoder Date: Fri, 26 Dec 2025 16:48:11 -0500 Subject: [PATCH 3/3] refactor(docker): remove byoc-entrypoint.sh and update entrypoint in Dockerfile - Deleted the `byoc-entrypoint.sh` script as it is no longer needed. - Updated the Dockerfile to use the existing `entrypoint.sh` script for running the BYOC server. - Adjusted permissions for the new entrypoint to ensure proper execution. --- docker/Dockerfile.base | 5 ++--- docker/byoc-entrypoint.sh | 18 ------------------ docker/entrypoint.sh | 9 +++++++++ 3 files changed, 11 insertions(+), 21 deletions(-) delete mode 100644 docker/byoc-entrypoint.sh diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index a692fa72..73f0b97f 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -90,8 +90,7 @@ RUN conda run -n comfystream --cwd /workspace/comfystream --no-capture-output pi COPY ./workflows/comfyui/* /workspace/ComfyUI/user/default/workflows/ COPY ./test/example-512x512.png /workspace/ComfyUI/input COPY ./docker/entrypoint.sh /workspace/comfystream/docker/entrypoint.sh -COPY ./docker/byoc-entrypoint.sh /usr/local/bin/byoc-entrypoint.sh -RUN chmod +x /usr/local/bin/byoc-entrypoint.sh +RUN chmod +x /workspace/comfystream/docker/entrypoint.sh # Install ComfyUI requirements RUN conda run -n comfystream --no-capture-output --cwd /workspace/ComfyUI pip install -r requirements.txt --constraint /workspace/comfystream/src/comfystream/scripts/constraints.txt --root-user-action=ignore @@ -121,6 +120,6 @@ RUN echo "conda activate comfystream" >> ~/.bashrc WORKDIR /workspace/comfystream # Run ComfyStream BYOC server by default but allow overriding the command -ENTRYPOINT ["/usr/local/bin/byoc-entrypoint.sh"] +ENTRYPOINT ["/workspace/comfystream/docker/entrypoint.sh"] # Default args; can be overridden/appended at runtime or replaced entirely CMD ["--workspace", "/workspace/ComfyUI", "--host", "0.0.0.0", "--port", "8000"] diff --git a/docker/byoc-entrypoint.sh b/docker/byoc-entrypoint.sh deleted file mode 100644 index 757e9f03..00000000 --- a/docker/byoc-entrypoint.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DEFAULT_CMD=(python /workspace/comfystream/server/byoc.py) - -# Allow `--` to separate entrypoint flags from the command -if [[ "${1:-}" == "--" ]]; then - shift -fi - -# If no args or first arg is an option, run the BYOC server with default args. -if [[ $# -eq 0 || "$1" == -* ]]; then - set -- "${DEFAULT_CMD[@]}" "$@" -fi - -exec conda run --no-capture-output -n comfystream --cwd /workspace/ComfyUI "$@" - diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index e6d44463..9d44d9d2 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -222,6 +222,15 @@ if [ "$START_COMFYUI" = true ] || [ "$START_API" = true ] || [ "$START_UI" = tru # Keep the script running tail -f /var/log/supervisord.log + exit 0 +fi + +# Activate conda environment +conda activate comfystream + +# If no args or first arg is an option, run the BYOC server with default args. +if [[ $# -eq 0 || "$1" == -* ]]; then + set -- python /workspace/comfystream/server/byoc.py "$@" fi exec "$@"