Debian Codegraph @

artifacts/images/agent-build.Dockerfile

raw
1 # Build the proxy-agent binary
2
3 ARG BUILDARCH
4 ARG GO_TOOLCHAIN
5 ARG GO_VERSION
6 ARG BASEIMAGE
7
8 FROM --platform=linux/${BUILDARCH} ${GO_TOOLCHAIN}:${GO_VERSION} AS builder
9
10 # Copy in the go src
11 WORKDIR /go/src/sigs.k8s.io/apiserver-network-proxy
12
13 # Copy the Go Modules manifests
14 COPY go.mod go.mod
15 COPY go.sum go.sum
16
17 # We have a replace directive for konnectivity-client in go.mod
18 COPY konnectivity-client/ konnectivity-client/
19
20 # Copy vendored modules
21 COPY vendor/ vendor/
22
23 # Copy the sources
24 COPY pkg/ pkg/
25 COPY cmd/ cmd/
26 COPY proto/ proto/
27
28
29 # Build
30 ARG TARGETARCH
31 RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -mod=vendor -v -a -ldflags '-extldflags "-static"' -o proxy-agent sigs.k8s.io/apiserver-network-proxy/cmd/agent
32
33 FROM ${BASEIMAGE}
34
35 WORKDIR /
36 COPY --from=builder /go/src/sigs.k8s.io/apiserver-network-proxy/proxy-agent .
37 ENTRYPOINT ["/proxy-agent"]