forked from llm-d/llm-d-router
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.coordinator
More file actions
47 lines (34 loc) · 1.28 KB
/
Copy pathDockerfile.coordinator
File metadata and controls
47 lines (34 loc) · 1.28 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
# BASE_IMAGE can be overridden at build time, e.g.:
# --build-arg BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-micro:9.7
# Default is distroless/static which includes CA certs and has minimal CVE surface.
# NOTE: if using scratch, CA certificates must be copied from the builder stage:
# COPY --from=builder /etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-bundle.crt
ARG BASE_IMAGE=gcr.io/distroless/static:nonroot
# Go build stage
FROM --platform=${BUILDPLATFORM} golang:1.26.5 AS builder
ARG TARGETOS
ARG TARGETARCH
ARG COMMIT_SHA=unknown
ARG BUILD_REF
ARG LDFLAGS="-s -w"
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.sum ./
# Download dependencies - this layer is cached as long as go.mod/go.sum are unchanged
RUN go mod download
# Copy the go source
COPY cmd/ cmd/
COPY pkg/ pkg/
COPY config/coordinator/ config/coordinator/
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
-ldflags="${LDFLAGS}" \
-o bin/coordinator ./cmd/coordinator/...
# Runtime stage
FROM ${BASE_IMAGE}
WORKDIR /
COPY --from=builder /workspace/bin/coordinator /coordinator
COPY --from=builder /workspace/config/coordinator/ /config/coordinator/
USER 65532:65532
EXPOSE 8080
ENTRYPOINT ["/coordinator", "--config", "/config/coordinator/coordinator.yaml"]
# Made with Bob