Skip to content

Commit 0c4e6c1

Browse files
committed
Merge branch docker-image.
2 parents 1b80b96 + dcf2e9f commit 0c4e6c1

File tree

3 files changed

+37
-18
lines changed

3 files changed

+37
-18
lines changed

Dockerfile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.13.7-slim-trixie
1+
FROM python:3.13.9-slim-trixie
22

33
ARG version=prod
44
ARG GIT_REF=main
@@ -14,21 +14,17 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y supervisor htop c
1414

1515
WORKDIR /srv/
1616

17-
1817
RUN git clone https://github.com/radlab-dev-group/llm-router.git && \
1918
cd /srv/llm-router && \
20-
git checkout ${GIT_REF} && \
21-
cat .git/HEAD > .version && git log -1 | head -1 >> .version && \
22-
rm -rf .git .gitignore
19+
git checkout ${GIT_REF}
2320

2421
WORKDIR /srv/llm-router
2522

26-
RUN pip3 install --upgrade pip && pip3 install -r requirements.txt
27-
28-
RUN pip3 install git+https://github.com/radlab-dev-group/ml-utils.git
23+
RUN pip3 install --upgrade pip
24+
RUN pip3 install --no-cache-dir .
25+
RUN pip3 install --no-cache-dir .[api]
2926

27+
COPY entrypoint.sh entrypoint.sh
3028
RUN chmod +x run-rest-api.sh && chmod +x entrypoint.sh
3129

32-
RUN cd llm_router_web && pip3 install -r requirements.txt && cd ..
33-
3430
ENTRYPOINT ["/srv/llm-router/entrypoint.sh"]

entrypoint.sh

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -e
33

4-
if [ "$1" = "SLEEP" ]; then
5-
echo "[Entrypoint] Debug mode: sleeping indefinitely..."
6-
sleep infinity
4+
# Default values
5+
APP_SCRIPT="run-rest-api-gunicorn.sh"
6+
DEBUG_MODE=false
7+
8+
for arg in "$@"; do
9+
case "$arg" in
10+
--debug|debug|--shell|shell)
11+
DEBUG_MODE=true
12+
;;
13+
--runserver|runserver)
14+
APP_SCRIPT="run-rest-api.sh"
15+
;;
16+
esac
17+
done
18+
19+
echo "[entrypoint] Working directory: $(pwd)"
20+
21+
if [ "$DEBUG_MODE" = true ]; then
22+
echo "[entrypoint] Debug mode activated. Container will stay alive for exec."
23+
sleep infinity
24+
exit 0
725
fi
826

9-
echo "[Entrypoint] Creating supervisord.conf ..."
10-
envsubst < docker/supervisord.conf.template > /etc/supervisor/conf.d/supervisord.conf
27+
if [ ! -f "./$APP_SCRIPT" ]; then
28+
echo "[entrypoint] ERROR: Script $APP_SCRIPT not found!"
29+
exit 1
30+
fi
1131

12-
echo "[Entrypoint] Starting supervisord..."
13-
supervisord
32+
echo "[entrypoint] Starting application using $APP_SCRIPT ..."
33+
exec "./$APP_SCRIPT"

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ flask
22
gunicorn
33
redis
44
prometheus_client
5+
python-dateutil
6+
# gevent
7+
58

69
python-gnupg

0 commit comments

Comments
 (0)