Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (35 loc) · 1.48 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (35 loc) · 1.48 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
# Build the manager binary
FROM golang:1.27.3 AS builder
ARG BUILDOS
ARG TARGETARCH
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 main.go main.go
COPY migration.go migration.go
COPY controllers/ controllers/
COPY internal/ internal/
COPY pkg/ pkg/
# Build
RUN CGO_ENABLED=0 GOOS=$BUILDOS GOARCH=$TARGETARCH go build -a -o manager .
# 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
ARG GIT_VERSION=unknown
LABEL org.opencontainers.image.source="https://github.com/projectsveltos/classifier" \
org.opencontainers.image.url="https://projectsveltos.io" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.vendor="projectsveltos" \
org.opencontainers.image.title="classifier" \
org.opencontainers.image.description="Dynamically classifies clusters based on run-time information (Kubernetes version, deployed resources, and more) and manages the resulting labels." \
org.opencontainers.image.version="$GIT_VERSION" \
org.opencontainers.image.revision="$GIT_VERSION"
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532
ENTRYPOINT ["/manager"]