From 7ec841a7a11d7976082e78eb4ab3d19062638dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serta=C3=A7=20=C3=96zercan?= <852750+sozercan@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:19:00 -0700 Subject: [PATCH] ci: fix dockerfile lint (#3474) Signed-off-by: Sertac Ozercan Co-authored-by: Rita Zhang --- Dockerfile | 2 +- crd.Dockerfile | 4 ++-- gator.Dockerfile | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6dd775c45b2..3d832e3e4df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ARG BUILDERIMAGE="golang:1.22-bookworm" # Refer to https://github.com/GoogleContainerTools/distroless for more details ARG BASEIMAGE="gcr.io/distroless/static-debian12:nonroot" -FROM --platform=$BUILDPLATFORM $BUILDERIMAGE as builder +FROM --platform=$BUILDPLATFORM $BUILDERIMAGE AS builder ARG TARGETPLATFORM ARG TARGETOS diff --git a/crd.Dockerfile b/crd.Dockerfile index 4f847d5c546..49e4a17054a 100644 --- a/crd.Dockerfile +++ b/crd.Dockerfile @@ -1,10 +1,10 @@ -FROM --platform=$TARGETPLATFORM registry.k8s.io/kubectl:v1.30.3 as builder +FROM --platform=$TARGETPLATFORM registry.k8s.io/kubectl:v1.30.3 AS builder ARG TARGETPLATFORM ARG TARGETOS ARG TARGETARCH -FROM scratch as build +FROM scratch AS build USER 65532:65532 COPY --chown=65532:65532 * /crds/ COPY --from=builder /bin/kubectl /kubectl diff --git a/gator.Dockerfile b/gator.Dockerfile index 6a014a76333..0fba2c5aa64 100644 --- a/gator.Dockerfile +++ b/gator.Dockerfile @@ -4,7 +4,7 @@ ARG BUILDERIMAGE="golang:1.22-bookworm" # Refer to https://github.com/GoogleContainerTools/distroless for more details ARG BASEIMAGE="gcr.io/distroless/static-debian12:nonroot" -FROM --platform=$BUILDPLATFORM $BUILDERIMAGE as builder +FROM --platform=$BUILDPLATFORM $BUILDERIMAGE AS builder ARG TARGETPLATFORM ARG TARGETOS @@ -23,7 +23,7 @@ WORKDIR /go/src/github.com/open-policy-agent/gatekeeper/cmd/gator RUN go build -mod vendor -a -ldflags "${LDFLAGS}" -o /gator -FROM --platform=$BUILDPLATFORM $BASEIMAGE as build +FROM --platform=$BUILDPLATFORM $BASEIMAGE AS build USER 65532:65532 COPY --from=builder --chown=65532:65532 /gator /gator ENTRYPOINT ["/gator"]