Skip to content

Commit e760195

Browse files
committed
✨ feat: add model-downloader service with init container integration
Signed-off-by: samzong <[email protected]>
1 parent 37e5941 commit e760195

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

.github/workflows/docker-publish.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
packages: write
4040
strategy:
4141
matrix:
42-
image: [extproc, llm-katan, dashboard]
42+
image: [extproc, llm-katan, dashboard, model-downloader]
4343
# Multi-architecture build strategy:
4444
# - AMD64: Native build on ubuntu-latest (fast)
4545
# - ARM64: Cross-compilation on ubuntu-latest (faster than emulation)
@@ -171,6 +171,10 @@ jobs:
171171
echo "context=." >> $GITHUB_OUTPUT
172172
echo "dockerfile=./dashboard/backend/Dockerfile" >> $GITHUB_OUTPUT
173173
echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT
174+
elif [ "${{ matrix.image }}" = "model-downloader" ]; then
175+
echo "context=." >> $GITHUB_OUTPUT
176+
echo "dockerfile=./Dockerfile.model-downloader" >> $GITHUB_OUTPUT
177+
echo "platform=linux/${{ matrix.arch }}" >> $GITHUB_OUTPUT
174178
fi
175179
176180
- name: Generate tags
@@ -236,7 +240,7 @@ jobs:
236240
packages: write
237241
strategy:
238242
matrix:
239-
image: [extproc, llm-katan, dashboard]
243+
image: [extproc, llm-katan, dashboard, model-downloader]
240244

241245
steps:
242246
- name: Log in to GitHub Container Registry

Dockerfile.model-downloader

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM python:3.11-slim
2+
3+
# Set environment variables
4+
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
5+
PIP_NO_CACHE_DIR=1 \
6+
PYTHONUNBUFFERED=1
7+
8+
# Add OCI labels
9+
LABEL org.opencontainers.image.source="https://github.com/vllm-project/semantic-router" \
10+
org.opencontainers.image.description="Lightweight model downloader for Semantic Router with huggingface_hub pre-installed"
11+
12+
WORKDIR /app
13+
14+
# Install minimal dependencies in a single layer
15+
RUN apt-get update && \
16+
apt-get install -y --no-install-recommends \
17+
ca-certificates \
18+
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* \
19+
&& pip install --no-cache-dir "huggingface_hub>=0.19.0" \
20+
&& find /usr/local -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true \
21+
&& find /usr/local -type f -name '*.pyc' -delete
22+
23+
# Set default entrypoint to bash to allow script execution from arguments
24+
ENTRYPOINT ["/bin/bash", "-c"]

deploy/helm/semantic-router/templates/deployment.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,14 @@ spec:
3232
{{- if .Values.initContainer.enabled }}
3333
initContainers:
3434
- name: model-downloader
35-
image: {{ .Values.initContainer.image }}
35+
image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}"
36+
imagePullPolicy: {{ .Values.initContainer.image.pullPolicy | default "IfNotPresent" }}
3637
securityContext:
3738
{{- toYaml .Values.securityContext | nindent 10 }}
3839
command: ["/bin/bash", "-c"]
3940
args:
4041
- |
4142
set -e
42-
echo "Installing Hugging Face Hub..."
43-
pip install -U --no-cache-dir "huggingface_hub>=0.19.0"
4443
4544
echo "Downloading models to persistent volume..."
4645
cd /app/models

deploy/helm/semantic-router/values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ initContainer:
131131
# -- Enable init container
132132
enabled: true
133133
# -- Init container image
134-
image: python:3.11-slim
134+
image:
135+
repository: ghcr.io/vllm-project/semantic-router/model-downloader
136+
tag: latest
137+
pullPolicy: IfNotPresent
135138
# -- Resource limits for init container
136139
resources:
137140
limits:

0 commit comments

Comments
 (0)