Skip to content

Commit 853c684

Browse files
authored
Use kv-cache-manager based on Go mod version instead of hardcoded (#484)
Currently the KVCACHE_MANAGER_VERSION is out of sync with the go mod which could cause bugs. Signed-off-by: Pierangelo Di Pilato <[email protected]>
1 parent d049265 commit 853c684

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Dockerfile.epp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ FROM quay.io/projectquay/golang:1.24 AS builder
44

55
ARG TARGETOS
66
ARG 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
2322
COPY cmd/ cmd/
2423
COPY 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)
3437
RUN 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
7982
RUN 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
8386
ENV 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
8588
RUN 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

Comments
 (0)