Skip to content

Commit 8644cbf

Browse files
committed
deploy.Dockerfile: fix git missing and replace heredoc with script file
- Install git before uv pip install (required for git+https:// deps) - Replace heredoc RUN (not portable across podman versions) with scripts/prefetch_artifacts.py copied into the image and executed
1 parent 9bb39a7 commit 8644cbf

2 files changed

Lines changed: 28 additions & 14 deletions

File tree

deploy.Dockerfile

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# syntax=docker/dockerfile:1
21
FROM python:3.12-slim
32

43
LABEL org.opencontainers.image.title="VTK MCP Gateway"
@@ -15,6 +14,10 @@ ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
1514
ARG VTK_VERSION=9.3.0
1615
ENV VTK_MCP_VTK_VERSION=${VTK_VERSION}
1716

17+
RUN apt-get update && \
18+
apt-get install -y --no-install-recommends git && \
19+
rm -rf /var/lib/apt/lists/*
20+
1821
WORKDIR /app
1922

2023
# Install uv for fast dependency installation
@@ -31,19 +34,8 @@ RUN uv pip install --system -e ".[retrieval]"
3134

3235
# Pre-download the vtk-knowledge JSONL artifact and vtk-index embedded
3336
# Qdrant storage so the image is ready to serve without network access.
34-
RUN python - <<'EOF'
35-
import logging
36-
logging.basicConfig(level=logging.INFO)
37-
import os
38-
vtk_version = os.environ["VTK_MCP_VTK_VERSION"]
39-
from vtk_knowledge import VTKAPIIndex
40-
VTKAPIIndex.from_artifact(vtk_version)
41-
try:
42-
from vtk_index import Retriever
43-
Retriever.from_artifact(vtk_version)
44-
except Exception as e:
45-
logging.warning("vtk-index embedded storage skipped: %s", e)
46-
EOF
37+
COPY scripts/prefetch_artifacts.py /tmp/prefetch_artifacts.py
38+
RUN python /tmp/prefetch_artifacts.py
4739

4840
ENV VTK_MCP_TRANSPORT=stdio
4941
ENV VTK_MCP_ENABLE_VALIDATION=true

scripts/prefetch_artifacts.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""Pre-fetch vtk-knowledge and vtk-index artifacts into the local cache.
2+
3+
Run during image build so the container serves requests without network access.
4+
"""
5+
6+
import logging
7+
import os
8+
9+
logging.basicConfig(level=logging.INFO)
10+
11+
vtk_version = os.environ["VTK_MCP_VTK_VERSION"]
12+
13+
from vtk_knowledge import VTKAPIIndex
14+
15+
VTKAPIIndex.from_artifact(vtk_version)
16+
17+
try:
18+
from vtk_index import Retriever
19+
20+
Retriever.from_artifact(vtk_version)
21+
except Exception as e:
22+
logging.warning("vtk-index embedded storage skipped: %s", e)

0 commit comments

Comments
 (0)