-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.Dockerfile
More file actions
81 lines (63 loc) · 2.64 KB
/
deploy.Dockerfile
File metadata and controls
81 lines (63 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
ARG DATABASE_IMAGE=ghcr.io/vicentebolea/vtk-data-database:latest
FROM ${DATABASE_IMAGE} AS database
FROM python:3.12-slim AS builder
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# VTK requires OpenGL libraries at introspection time
RUN apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y \
libgl1-mesa-dev \
libxrender1 \
git && \
rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Install vtk-data with extraction dependencies (VTK + LiteLLM)
RUN pip install "vtk-data[extract] @ git+https://github.com/vicentebolea/vtk-data.git"
# Two modes, controlled by build arg:
#
# SKIP_EXTRACT=false (default)
# Runs vtk-data extract. Requires --secret id=llm_api_key.
# Build command:
# podman build --secret id=llm_api_key,src=~/.llm_api_key -f deploy.Dockerfile .
#
# SKIP_EXTRACT=true
# Copies vtk-python-docs.jsonl from the pre-built database image.
# Build command:
# podman build --build-arg SKIP_EXTRACT=true -f deploy.Dockerfile .
ARG SKIP_EXTRACT=false
COPY --from=database /vtk-python-docs.jsonl /build/docs/vtk-python-docs.jsonl.cached
RUN --mount=type=secret,id=llm_api_key,required=false \
if [ "$SKIP_EXTRACT" = "true" ]; then \
echo "Using existing database from image..." && \
cp /build/docs/vtk-python-docs.jsonl.cached /build/docs/vtk-python-docs.jsonl; \
else \
export OPENAI_API_KEY=$(cat /run/secrets/llm_api_key 2>/dev/null || true) && \
vtk-data extract --output /build; \
fi
FROM python:3.12-slim
LABEL org.opencontainers.image.title="VTK MCP Server"
LABEL org.opencontainers.image.description="Model Context Protocol server for VTK documentation"
LABEL org.opencontainers.image.source="https://github.com/kitware/vtk-mcp"
LABEL org.opencontainers.image.licenses="MIT"
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
RUN apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y git && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install vtk-mcp and vtk-data[rag] (Qdrant retriever)
COPY . .
RUN pip install --upgrade pip && \
pip install torch --index-url https://download.pytorch.org/whl/cpu && \
pip install "vtk-data[rag] @ git+https://github.com/vicentebolea/vtk-data.git" && \
pip install .
COPY --from=builder /build/docs/vtk-python-docs.jsonl /app/data/vtk-python-docs.jsonl
CMD ["vtk-mcp-server", \
"--transport", "http", \
"--host", "0.0.0.0", \
"--port", "8000", \
"--data-path", "/app/data/vtk-python-docs.jsonl"]