generated from cloudoperators/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
28 lines (22 loc) · 866 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
# Build the manager binary
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 AS builder
ARG TARGETOS
ARG TARGETARCH
ENV CGO_ENABLED=0
WORKDIR /workspace
COPY Makefile .
RUN make action-controllergen
COPY . .
# Build greenhouse operator and tooling.
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
make action-build CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH}
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM --platform=${BUILDPLATFORM:-linux/amd64} gcr.io/distroless/static:nonroot
LABEL source_repository="https://github.com/cloudoperators/greenhouse"
WORKDIR /
COPY --from=builder /workspace/bin/* .
USER 65532:65532
RUN ["/greenhouse", "--version"]
ENTRYPOINT ["/greenhouse"]