-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (25 loc) · 846 Bytes
/
Dockerfile
File metadata and controls
30 lines (25 loc) · 846 Bytes
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
FROM --platform=$BUILDPLATFORM golang:1.24 as builder
ARG TAG
ARG COMMIT
ARG REPO_INFO
ARG DATE
ARG TARGETOS
ARG TARGETARCH
WORKDIR /workspace
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY pkg/ pkg/
COPY api/ api/
COPY cmd/ cmd/
COPY controllers/ controllers/
COPY main.go main.go
# Build
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags "-X 'github.com/keikoproj/addon-manager/pkg/version.GitCommit=${COMMIT}' -X 'github.com/keikoproj/addon-manager/pkg/version.BuildDate=${DATE}'" -a -o manager main.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot AS distroless
WORKDIR /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
ENTRYPOINT ["/manager"]