improve dockerfile

This commit is contained in:
Cyberes 2023-09-27 14:59:33 -06:00
parent 105b66d5e2
commit eade509947
4 changed files with 32 additions and 5 deletions

View File

@ -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
CMD /app/start.sh

View File

@ -0,0 +1,7 @@
#!/bin/bash
mkdir -p /storage/vllm/
chown -R apiserver:apiserver /storage/vllm
touch /storage/vllm/cmd.txt
/usr/bin/supervisord

View File

@ -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)

View File

@ -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