From ef44a167573741b193e5c1038274b63e22e36cde Mon Sep 17 00:00:00 2001 From: jasl Date: Sun, 22 Oct 2023 22:51:50 +0800 Subject: [PATCH 1/3] Use entrypoint style for enduser apps --- jetson_containers/container.py | 1 + packages/diffusion/stable-diffusion-webui/Dockerfile | 6 ++++-- .../stable-diffusion-webui/docker-entrypoint.sh | 5 +++++ packages/jupyterlab/Dockerfile | 9 +++++---- packages/jupyterlab/docker-entrypoint.sh | 9 +++++++++ packages/llm/text-generation-webui/Dockerfile | 6 ++++-- packages/llm/text-generation-webui/docker-entrypoint.sh | 5 +++++ 7 files changed, 33 insertions(+), 8 deletions(-) create mode 100755 packages/diffusion/stable-diffusion-webui/docker-entrypoint.sh create mode 100755 packages/jupyterlab/docker-entrypoint.sh create mode 100755 packages/llm/text-generation-webui/docker-entrypoint.sh diff --git a/jetson_containers/container.py b/jetson_containers/container.py index 7053a6354..fee5a8299 100644 --- a/jetson_containers/container.py +++ b/jetson_containers/container.py @@ -295,6 +295,7 @@ def test_container(name, package, simulate=False): cmd += f"--volume {package['path']}:/test" + _NEWLINE_ cmd += f"--volume {os.path.join(_PACKAGE_ROOT, 'data')}:/data" + _NEWLINE_ cmd += f"--workdir /test" + _NEWLINE_ + cmd += f"--entrypoint ''" + _NEWLINE_ cmd += name + _NEWLINE_ cmd += "/bin/bash -c '" diff --git a/packages/diffusion/stable-diffusion-webui/Dockerfile b/packages/diffusion/stable-diffusion-webui/Dockerfile index 636744898..b4a240af7 100644 --- a/packages/diffusion/stable-diffusion-webui/Dockerfile +++ b/packages/diffusion/stable-diffusion-webui/Dockerfile @@ -34,6 +34,8 @@ RUN cd /opt/stable-diffusion-webui && \ # set the cache dir for models ENV DIFFUSERS_CACHE=/data/models/diffusers -# default start-up command -CMD /bin/bash -c "cd /opt/stable-diffusion-webui && python3 launch.py --data=/data/models/stable-diffusion --enable-insecure-extension-access --xformers --listen --port=7860" +COPY docker-entrypoint.sh /usr/local/bin +WORKDIR /opt/stable-diffusion-webui + +ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/packages/diffusion/stable-diffusion-webui/docker-entrypoint.sh b/packages/diffusion/stable-diffusion-webui/docker-entrypoint.sh new file mode 100755 index 000000000..125ef8cd7 --- /dev/null +++ b/packages/diffusion/stable-diffusion-webui/docker-entrypoint.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +cd /opt/stable-diffusion-webui && python3 launch.py --data=/data/models/stable-diffusion --enable-insecure-extension-access --xformers --listen --port=7860 "$@" diff --git a/packages/jupyterlab/Dockerfile b/packages/jupyterlab/Dockerfile index c41495e22..cb94b3f0e 100644 --- a/packages/jupyterlab/Dockerfile +++ b/packages/jupyterlab/Dockerfile @@ -14,7 +14,8 @@ RUN pip3 install --no-cache-dir --verbose jupyter 'jupyterlab<4' && \ RUN jupyter lab --version && jupyter lab --generate-config RUN python3 -c "from notebook.auth.security import set_password; set_password('nvidia', '/root/.jupyter/jupyter_notebook_config.json')" -CMD /bin/bash -c "jupyter lab --ip 0.0.0.0 --port 8888 --allow-root &> /var/log/jupyter.log" & \ - echo "allow 10 sec for JupyterLab to start @ http://$(hostname -I | cut -d' ' -f1):8888 (password nvidia)" && \ - echo "JupterLab logging location: /var/log/jupyter.log (inside the container)" && \ - /bin/bash +COPY docker-entrypoint.sh /usr/local/bin + +ENTRYPOINT ["docker-entrypoint.sh"] + +CMD ["/bin/bash"] diff --git a/packages/jupyterlab/docker-entrypoint.sh b/packages/jupyterlab/docker-entrypoint.sh new file mode 100755 index 000000000..7aac1c3d7 --- /dev/null +++ b/packages/jupyterlab/docker-entrypoint.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +jupyter lab --ip 0.0.0.0 --port 8888 --allow-root &> /var/log/jupyter.log & +echo "allow 10 sec for JupyterLab to start @ http://$(hostname -I | cut -d' ' -f1):8888 (password nvidia)" + +echo "JupterLab logging location: /var/log/jupyter.log (inside the container)" +exec "$@" diff --git a/packages/llm/text-generation-webui/Dockerfile b/packages/llm/text-generation-webui/Dockerfile index f9744c75e..b78ae8e83 100644 --- a/packages/llm/text-generation-webui/Dockerfile +++ b/packages/llm/text-generation-webui/Dockerfile @@ -79,6 +79,8 @@ ENV LD_PRELOAD=${LD_PRELOAD}:${LD_PRELOAD_LIBS} COPY settings.json text-generation-webui/ -WORKDIR / +COPY docker-entrypoint.sh /usr/local/bin -CMD /bin/bash -c "cd /opt/text-generation-webui && python3 server.py --model-dir=/data/models/text-generation-webui --listen --verbose" +WORKDIR /opt/text-generation-webui + +ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/packages/llm/text-generation-webui/docker-entrypoint.sh b/packages/llm/text-generation-webui/docker-entrypoint.sh new file mode 100755 index 000000000..49dcafaf0 --- /dev/null +++ b/packages/llm/text-generation-webui/docker-entrypoint.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +cd /opt/text-generation-webui && python3 server.py --model-dir=/data/models/text-generation-webui --listen --verbose "$@" From 4444c98afde363be6ccb9885038ff505ce382932 Mon Sep 17 00:00:00 2001 From: jasl Date: Sun, 22 Oct 2023 22:52:00 +0800 Subject: [PATCH 2/3] minor fix --- packages/audio/riva-client/Dockerfile.python | 3 +-- packages/tvm/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/audio/riva-client/Dockerfile.python b/packages/audio/riva-client/Dockerfile.python index 3105bfba7..5061ddfc9 100644 --- a/packages/audio/riva-client/Dockerfile.python +++ b/packages/audio/riva-client/Dockerfile.python @@ -39,5 +39,4 @@ RUN pip3 show nvidia-riva-client && python3 -c 'import riva.client; print(riva.c COPY list_audio_devices.py python-clients/scripts/ COPY loopback.py python-clients/scripts/ - -WORKDIR / \ No newline at end of file +WORKDIR / diff --git a/packages/tvm/Dockerfile b/packages/tvm/Dockerfile index f9b954279..800990e6e 100644 --- a/packages/tvm/Dockerfile +++ b/packages/tvm/Dockerfile @@ -73,4 +73,4 @@ RUN pip3 show tvm && python3 -c 'import tvm' ENV TVM_HOME=/opt/tvm -ln -s /opt/mlc-llm/3rdparty/tvm/3rdparty /usr/local/lib/python3.8/dist-packages/tvm/3rdparty \ No newline at end of file +RUN ln -s /opt/mlc-llm/3rdparty/tvm/3rdparty /usr/local/lib/python3.8/dist-packages/tvm/3rdparty From a5ae569e9f9e62a5789dc16b1cad4b32720e42a6 Mon Sep 17 00:00:00 2001 From: jasl Date: Sun, 12 Nov 2023 02:24:38 +0800 Subject: [PATCH 3/3] avoid to use empty entrypoint --- jetson_containers/container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetson_containers/container.py b/jetson_containers/container.py index fee5a8299..07034c054 100644 --- a/jetson_containers/container.py +++ b/jetson_containers/container.py @@ -295,7 +295,7 @@ def test_container(name, package, simulate=False): cmd += f"--volume {package['path']}:/test" + _NEWLINE_ cmd += f"--volume {os.path.join(_PACKAGE_ROOT, 'data')}:/data" + _NEWLINE_ cmd += f"--workdir /test" + _NEWLINE_ - cmd += f"--entrypoint ''" + _NEWLINE_ + cmd += f"--entrypoint /usr/bin/env" + _NEWLINE_ cmd += name + _NEWLINE_ cmd += "/bin/bash -c '"