From eade509947d768975f9c078783885b0b4fdcd38d Mon Sep 17 00:00:00 2001 From: Cyberes Date: Wed, 27 Sep 2023 14:59:33 -0600 Subject: [PATCH] improve dockerfile --- other/vllm/Docker/Dockerfile | 10 +++++++--- other/vllm/Docker/start-container.sh | 7 +++++++ other/vllm/Docker/start-vllm.sh | 16 ++++++++++++++++ other/vllm/Docker/supervisord.conf | 4 ++-- 4 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 other/vllm/Docker/start-container.sh create mode 100644 other/vllm/Docker/start-vllm.sh diff --git a/other/vllm/Docker/Dockerfile b/other/vllm/Docker/Dockerfile index afd23f7..55111a7 100644 --- a/other/vllm/Docker/Dockerfile +++ b/other/vllm/Docker/Dockerfile @@ -59,14 +59,18 @@ COPY --from=build /app /app COPY --from=build /jupyterlab /jupyterlab RUN cp /local-llm-server/other/vllm/Docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -RUN echo '#!/bin/bash\n/venv/bin/python /local-llm-server/other/vllm/vllm_api_server.py --host 0.0.0.0 --port 7000 $(cat /storage/vllm/cmd.txt)' > /app/start-vllm.sh +RUN echo '' > /app/start-vllm.sh COPY ./rathole-client.toml /app/client.toml COPY ./jupyter /app/jupyter COPY ./ssh /root/.ssh +COPY ./start-container.sh /app/start.sh + +RUN mkdir -p /var/log/app/ RUN chown -R apiserver:apiserver /local-llm-server && \ - chown -R apiserver:apiserver /app + chown -R apiserver:apiserver /app && \ + chown -R apiserver:apiserver /var/log/app/ ENV SHELL="/bin/bash" @@ -79,4 +83,4 @@ EXPOSE 7000 # Jupyter EXPOSE 8888 -CMD /usr/bin/supervisord \ No newline at end of file +CMD /app/start.sh \ No newline at end of file diff --git a/other/vllm/Docker/start-container.sh b/other/vllm/Docker/start-container.sh new file mode 100644 index 0000000..fb7e9f2 --- /dev/null +++ b/other/vllm/Docker/start-container.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +mkdir -p /storage/vllm/ +chown -R apiserver:apiserver /storage/vllm +touch /storage/vllm/cmd.txt + +/usr/bin/supervisord \ No newline at end of file diff --git a/other/vllm/Docker/start-vllm.sh b/other/vllm/Docker/start-vllm.sh new file mode 100644 index 0000000..c35b3a4 --- /dev/null +++ b/other/vllm/Docker/start-vllm.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Kill old processes +pids1=$(ps aux | grep '[b]ash /app/start-vllm.sh' | awk '{print $2}') +pids2=$(ps aux | grep '/venv/bin/python /local-llm-server/other/vllm/vllm_api_server.py' | awk '{print $2}') + +# Kill the processes +for pid in $pids1; do + kill -9 $pid +done + +for pid in $pids2; do + kill -9 $pid +done + +/venv/bin/python /local-llm-server/other/vllm/vllm_api_server.py --host 0.0.0.0 --port 7000 $(cat /storage/vllm/cmd.txt) diff --git a/other/vllm/Docker/supervisord.conf b/other/vllm/Docker/supervisord.conf index f4cb51e..bf3c093 100644 --- a/other/vllm/Docker/supervisord.conf +++ b/other/vllm/Docker/supervisord.conf @@ -2,7 +2,7 @@ nodaemon=true [program:api_server] -command=bash /app/start-vllm.sh +command=bash /app/start-vllm.sh 2>&1 | tee /var/log/app/vllm.log autostart=true autorestart=true stdout_logfile=/dev/fd/1 @@ -13,7 +13,7 @@ user=apiserver environment=HOME="/home/apiserver",USER="apiserver" [program:proxy] -command=/app/rathole -c /app/client.toml +command=/app/rathole -c /app/client.toml 2>&1 | tee /var/log/app/rathole.log autostart=true autorestart=true stdout_logfile=/dev/fd/1