11## Minimal runtime Dockerfile (microdnf-only, no torch, wrapper in site-packages)
2- # Build Stage: using Go 1.24 image
3- FROM registry.access.redhat.com/ubi9/go-toolset:1.24 AS builder
2+ ## Simplified EPP Dockerfile - UDS tokenizer only (no vLLM, no embedded tokenizer)
3+ ## This build uses the default kv-cache pool (UDS-only, no embedded_tokenizers build tag)
4+ ## Tokenization is handled by a separate UDS tokenizer sidecar container
5+ ##
6+ ## CGO is still required for ZMQ (kvevents) but Python/vLLM dependencies are removed
7+ # Go build stage
8+ FROM registry.access.redhat.com/ubi9/go-toolset:1.25.7 AS go-builder
49
510ARG TARGETOS
611ARG TARGETARCH
712
813USER root
914
10- # Install build tools
11- # The builder is based on UBI8, so we need epel-release-8.
15+ WORKDIR /workspace
16+
17+ # Install ZMQ development libraries (required for CGO)
18+ # The builder is based on UBI8, so we need epel-release-9
1219RUN dnf install -y 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' && \
13- dnf install -y gcc-c++ libstdc++ libstdc++-devel clang zeromq-devel pkgconfig python3.12-devel python3.12-pip git && \
20+ dnf install -y zeromq-devel pkgconfig && \
1421 dnf clean all
15- # python3.12-devel needed for CGO compilation (Python headers and python3.12-config for linker flags)
16-
17- WORKDIR /workspace
1822
1923# Copy the Go Modules manifests
2024COPY go.mod go.mod
@@ -26,79 +30,26 @@ COPY pkg/ pkg/
2630
2731RUN go mod download
2832
29- # Copy Python wrapper and requirements from kv-cache-manager dependency
30- # Extract version dynamically and copy to a known location
31- RUN KVCACHE_MANAGER_VERSION=$(go list -m -f '{{.Version}}' github.com/llm-d/llm-d-kv-cache-manager) && \
32- mkdir -p /workspace/kv-cache-manager-wrapper && \
33- cp $(go env GOMODCACHE)/github.com/llm-d/llm-d-kv-cache-manager@${KVCACHE_MANAGER_VERSION}/pkg/preprocessing/chat_completions/render_jinja_template_wrapper.py \
34- /workspace/kv-cache-manager-wrapper/ && \
35- cp $(go env GOMODCACHE)/github.com/llm-d/llm-d-kv-cache-manager@${KVCACHE_MANAGER_VERSION}/pkg/preprocessing/chat_completions/requirements.txt \
36- /workspace/kv-cache-manager-wrapper/requirements.txt
37-
38- # HuggingFace tokenizer bindings (static lib)
39- RUN mkdir -p lib
40- # Ensure that the RELEASE_VERSION matches the one used in the imported llm-d-kv-cache-manager version
41- ARG RELEASE_VERSION=v1.22.1
42- RUN curl -L https://github.com/daulet/tokenizers/releases/download/${RELEASE_VERSION}/libtokenizers.${TARGETOS}-${TARGETARCH}.tar.gz | tar -xz -C lib
43- RUN ranlib lib/*.a
44-
45- # Build
46- # the GOARCH has not a default value to allow the binary be built according to the host where the command
47- # was called. For example, if we call make image-build in a local env which has the Apple Silicon M1 SO
48- # the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
49- # by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
50- ENV CGO_ENABLED=1
51- ENV GOOS=${TARGETOS:-linux}
52- ENV GOARCH=${TARGETARCH}
53- ENV PYTHON=python3.12
54- ENV PYTHONPATH=/usr/lib64/python3.12/site-packages:/usr/lib/python3.12/site-packages
55-
56- ARG COMMIT_SHA=unknown
57- ARG BUILD_REF
58- RUN export CGO_CFLAGS="$(python3.12-config --cflags) -I/workspace/lib" && \
59- export CGO_LDFLAGS="$(python3.12-config --ldflags --embed) -L/workspace/lib -ltokenizers -ldl -lm" && \
60- go build -a -o bin/epp -ldflags="-extldflags '-L$(pwd)/lib' -X sigs.k8s.io/gateway-api-inference-extension/version.CommitSHA=${COMMIT_SHA} -X sigs.k8s.io/gateway-api-inference-extension/version.BuildRef=${BUILD_REF}" cmd/epp/main.go
33+ # Build EPP with CGO for ZMQ only (no Python, no embedded tokenizer)
34+ # The default kv-cache build uses UDS tokenizer (//go:build !embedded_tokenizers)
35+ RUN CGO_ENABLED=1 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o bin/epp cmd/epp/main.go
6136
6237# Runtime stage
6338# Use ubi9 as a minimal base image to package the manager binary
6439# Refer to https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5 for more details
65- FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
40+ FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7
41+
6642WORKDIR /
67- COPY --from=builder /workspace/bin/epp /app/epp
6843
69- USER root
70- # Install zeromq runtime library and Python runtime needed by the manager.
71- # The final image is UBI9, so we need epel-release-9.
72- # Using microdnf for minimal image size
44+ # Install ZMQ runtime library only (no Python needed)
7345RUN curl -L -o /tmp/epel-release.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
7446 rpm -i /tmp/epel-release.rpm && \
7547 rm /tmp/epel-release.rpm && \
76- microdnf install -y --setopt=install_weak_deps=0 zeromq python3.12 python3.12-libs python3.12-pip && \
48+ microdnf install -y --setopt=install_weak_deps=0 zeromq && \
7749 microdnf clean all && \
78- rm -rf /var/cache/yum /var/lib/yum && \
79- ln -sf /usr/bin/python3.12 /usr/bin/python3 && \
80- ln -sf /usr/bin/python3.12 /usr/bin/python
81- # Note: python3.12 package does not automatically create python3/python symlinks - they must be created manually
82-
83- # Install wrapper as a module in site-packages
84- RUN mkdir -p /usr/local/lib/python3.12/site-packages/
85- COPY --from=builder /workspace/kv-cache-manager-wrapper/render_jinja_template_wrapper.py /usr/local/lib/python3.12/site-packages/
86-
87- # Python deps (no cache, single target) – filter out torch
88- ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
89- COPY --from=builder /workspace/kv-cache-manager-wrapper/requirements.txt /tmp/requirements.txt
90- RUN sed '/^torch\b/d' /tmp/requirements.txt > /tmp/requirements.notorch.txt && \
91- python3.12 -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
92- python3.12 -m pip install --no-cache-dir --target /usr/local/lib/python3.12/site-packages -r /tmp/requirements.notorch.txt && \
93- python3.12 -m pip install --no-cache-dir --target /usr/local/lib/python3.12/site-packages PyYAML && \
94- rm /tmp/requirements.txt /tmp/requirements.notorch.txt && \
95- rm -rf /root/.cache/pip
50+ rm -rf /var/cache/yum /var/lib/yum
9651
97- # Python env
98- ENV PYTHONPATH="/usr/local/lib/python3.12/site-packages:/usr/lib/python3.12/site-packages"
99- ENV PYTHON=python3.12
100- ENV PATH=/usr/bin:/usr/local/bin:$PATH
101- ENV HF_HOME="/tmp/.cache"
52+ COPY --from=go-builder /workspace/bin/epp /app/epp
10253
10354USER 65532:65532
10455
0 commit comments