"docs/vscode:/vscode.git/clone" did not exist on "c57c9415b17f014e5600b4b2cb6b7f0b70cfaa07"
Dockerfile.epp 2.72 KB
Newer Older
1
2
#  SPDX-FileCopyrightText:  Copyright The Kubernetes Authors.
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
# SPDX-License-Identifier: Apache-2.0
4
5
6
7
8
9
10
11
12
13
14
15
16
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#  #
#  http://www.apache.org/licenses/LICENSE-2.0
#  #
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#  Modifications Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

# Dockerfile.epp - Custom Dockerfile for GAIE EPP. This is to be used with the deploy/inference-gateway/build-epp-dynamo.sh

ARG BUILDER_IMAGE=golang:1.24
ARG BASE_IMAGE=ubuntu:22.04

############################
# Builder
############################
FROM ${BUILDER_IMAGE} AS builder

ENV CGO_ENABLED=1
# be explicit; helps cgo when linking libstdc++
ENV CC=gcc
ENV CXX=g++

# C/C++ toolchain for cgo, and libstdc++ for link-time
RUN apt-get update && apt-get install -y --no-install-recommends \
35
36
37
38
39
  build-essential \
  gcc g++ \
  libc6-dev \
  ca-certificates \
  && rm -rf /var/lib/apt/lists/*
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

ARG COMMIT_SHA=unknown
ARG BUILD_REF

WORKDIR /src

# deps first (cache)
COPY go.mod go.sum ./
RUN go mod download

# source
COPY cmd/epp ./cmd/epp
COPY pkg/epp ./pkg/epp
COPY internal ./internal
COPY api ./api

# sanity (optional)
RUN ls -la pkg/epp/scheduling/plugins/dynamo_kv_scorer/include/ || echo "Headers not found"
RUN ls -la pkg/epp/scheduling/plugins/dynamo_kv_scorer/lib/ || echo "Library not found"

# build
WORKDIR /src/cmd/epp
RUN go build \
  -ldflags="-X sigs.k8s.io/gateway-api-inference-extension/pkg/epp/metrics.CommitSHA=${COMMIT_SHA} -X sigs.k8s.io/gateway-api-inference-extension/pkg/epp/metrics.BuildRef=${BUILD_REF}" \
  -o /epp

############################
# Runtime
############################
FROM ${BASE_IMAGE} AS runtime

71
72
73
ARG DYNAMO_COMMIT_SHA
ENV DYNAMO_COMMIT_SHA=$DYNAMO_COMMIT_SHA

74
75
# Minimal runtime deps; include libstdc++ runtime for -lstdc++
RUN apt-get update && apt-get install -y --no-install-recommends \
76
77
78
79
80
81
  ca-certificates \
  libstdc++6 \
  && rm -rf /var/lib/apt/lists/* \
  && groupadd -r nonroot && useradd -r -g nonroot -m -d /home/nonroot nonroot \
  && mkdir -p /home/nonroot/.cache/huggingface/hub \
  && chown -R nonroot:nonroot /home/nonroot
82
83
84
85

WORKDIR /
COPY --from=builder /epp /epp

86
87
88
# Set HOME so ModelExpress can find the cache directory
ENV HOME=/home/nonroot

89
90
USER nonroot:nonroot
ENTRYPOINT ["/epp"]