Make run model a oneshot service
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
3dcb3ce021
commit
55ce7d9fc2
4 changed files with 28 additions and 8 deletions
13
Dockerfile
13
Dockerfile
|
@ -25,18 +25,19 @@ gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.
|
|||
|
||||
RUN mv /tmp/oneAPI.repo /etc/yum.repos.d/oneAPI.repo && \
|
||||
dnf update && \
|
||||
dnf install intel-oneapi-mkl -y && \
|
||||
dnf install intel-oneapi-mkl epel-release -y && \
|
||||
dnf update && \
|
||||
dnf install supervisor -y && \
|
||||
mkdir /ollama
|
||||
|
||||
COPY --from=build /app/ollama /ollama
|
||||
|
||||
ADD entrypoint.sh /
|
||||
COPY --from=build /app/serve.sh /ollama/serve.sh
|
||||
COPY --from=build /app/run_model.sh /ollama/run_model.sh
|
||||
COPY --from=build /app/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
ENV MODEL_NAME="llama"
|
||||
ENV OLLAMA_HOST="0.0.0.0:8080"
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
CMD ["/ollama/ollama", "run", "model"]
|
||||
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
. /opt/intel/oneapi/setvars.sh
|
||||
|
||||
/ollama/ollama serve &
|
||||
sleep 10
|
||||
|
||||
if [ -n "$INIT_MODELS" ]; then
|
||||
/ollama/ollama rm model || true
|
||||
|
@ -10,4 +10,4 @@ if [ -n "$INIT_MODELS" ]; then
|
|||
/ollama/ollama create -f /tmp/Modelfile model
|
||||
fi
|
||||
|
||||
exec $@
|
||||
/ollama/ollama run model
|
5
serve.sh
Executable file
5
serve.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
. /opt/intel/oneapi/setvars.sh
|
||||
|
||||
/ollama/ollama serve
|
14
supervisord.conf
Normal file
14
supervisord.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:ollama]
|
||||
command=/ollama/serve.sh
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[program:run_model]
|
||||
command=/ollama/run_model.sh
|
||||
autostart=true
|
||||
autorestart=false
|
||||
startsecs=0
|
||||
exitcodes=0
|
Loading…
Reference in a new issue