forked from brancz/kube-rbac-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (28 loc) · 948 Bytes
/
Dockerfile
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
ARG BUILDER_GOLANG_VERSION
FROM --platform=$TARGETPLATFORM us-docker.pkg.dev/palette-images/build-base-images/golang:${BUILDER_GOLANG_VERSION}-alpine as builder
ARG TARGETOS
ARG TARGETARCH
ARG CRYPTO_LIB
ENV GOEXPERIMENT=${CRYPTO_LIB:+boringcrypto}
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY . .
RUN mkdir -p bin
RUN if [ ${CRYPTO_LIB} ]; \
then \
go-build-fips.sh -o bin/kube-rbac-proxy cmd/kube-rbac-proxy/main.go ;\
else \
go-build-static.sh -o bin/kube-rbac-proxy cmd/kube-rbac-proxy/main.go ;\
fi
FROM gcr.io/distroless/static
WORKDIR /bin
COPY --from=builder /workspace/bin/kube-rbac-proxy .
EXPOSE 8080
USER 65532:65532
ENTRYPOINT ["/bin/kube-rbac-proxy"]