@@ -4,7 +4,6 @@ FROM quay.io/projectquay/golang:1.24 AS builder
44
55ARG TARGETOS
66ARG TARGETARCH
7- ARG KVCACHE_MANAGER_VERSION=v0.3.2
87
98# Install build tools
109# The builder is based on UBI8, so we need epel-release-8.
@@ -22,13 +21,17 @@ COPY go.sum go.sum
2221# Copy the go source
2322COPY cmd/ cmd/
2423COPY pkg/ pkg/
25- COPY scripts/fetch-python-wrapper.sh scripts/fetch-python-wrapper.sh
2624
27- # Fetch requirements only (install in runtime)
28- RUN curl -L https://raw.githubusercontent.com/llm-d/llm-d-kv-cache-manager/${KVCACHE_MANAGER_VERSION}/pkg/preprocessing/chat_completions/requirements.txt -o /workspace/requirements.txt
25+ RUN go mod download
2926
30- # Prepare Python wrapper file for runtime
31- RUN scripts/fetch-python-wrapper.sh ${KVCACHE_MANAGER_VERSION} /workspace/llm-d-kv-cache-manager/pkg/preprocessing/chat_completions
27+ # Copy Python wrapper and requirements from kv-cache-manager dependency
28+ # Extract version dynamically and copy to a known location
29+ RUN KVCACHE_MANAGER_VERSION=$(go list -m -f '{{.Version}}' github.com/llm-d/llm-d-kv-cache-manager) && \
30+ mkdir -p /workspace/kv-cache-manager-wrapper && \
31+ cp /go/pkg/mod/github.com/llm-d/llm-d-kv-cache-manager@${KVCACHE_MANAGER_VERSION}/pkg/preprocessing/chat_completions/render_jinja_template_wrapper.py \
32+ /workspace/kv-cache-manager-wrapper/ && \
33+ cp /go/pkg/mod/github.com/llm-d/llm-d-kv-cache-manager@${KVCACHE_MANAGER_VERSION}/pkg/preprocessing/chat_completions/requirements.txt \
34+ /workspace/kv-cache-manager-wrapper/requirements.txt
3235
3336# HuggingFace tokenizer bindings (static lib)
3437RUN mkdir -p lib
@@ -77,11 +80,11 @@ RUN curl -L -o /tmp/epel-release.rpm https://dl.fedoraproject.org/pub/epel/epel-
7780
7881# Install wrapper as a module in site-packages
7982RUN mkdir -p /usr/local/lib/python3.12/site-packages/
80- COPY --from=builder /workspace/llm-d- kv-cache-manager/pkg/preprocessing/chat_completions /render_jinja_template_wrapper.py /usr/local/lib/python3.12/site-packages/
83+ COPY --from=builder /workspace/kv-cache-manager-wrapper /render_jinja_template_wrapper.py /usr/local/lib/python3.12/site-packages/
8184
8285# Python deps (no cache, single target) – filter out torch
8386ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
84- COPY --from=builder /workspace/requirements.txt /tmp/requirements.txt
87+ COPY --from=builder /workspace/kv-cache-manager-wrapper/ requirements.txt /tmp/requirements.txt
8588RUN sed '/^torch\b/d' /tmp/requirements.txt > /tmp/requirements.notorch.txt && \
8689 python3.12 -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
8790 python3.12 -m pip install --no-cache-dir --target /usr/local/lib/python3.12/site-packages -r /tmp/requirements.notorch.txt && \
0 commit comments