clusterlint/Dockerfile

27 lines
698 B
Docker
Raw Normal View History

# Build the clusterlint binary
2022-10-13 15:00:38 +00:00
FROM golang:1.19 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY vendor/ vendor/
# Copy the go source
COPY cmd/clusterlint/main.go main.go
COPY kube/ kube/
COPY checks checks/
# Build
RUN GOFLAGS="-mod=vendor" CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on \
go build -a -o clusterlint main.go
# Use distroless as minimal base image to package the clusterlint binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/clusterlint .
USER nonroot:nonroot
ENTRYPOINT ["/clusterlint"]
CMD ["-h"]