From 41db392de1490ac9d26f8490c2702bb8161025a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serta=C3=A7=20=C3=96zercan?= <852750+sozercan@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:17:16 -0700 Subject: [PATCH] ci: remove dockerfile buildplatform (#3491) Signed-off-by: Sertac Ozercan Co-authored-by: Jaydipkumar Arvindbhai Gabani --- Dockerfile | 10 ++-------- gator.Dockerfile | 10 ++-------- test/externaldata/dummy-provider/Dockerfile | 8 ++------ test/pubsub/fake-subscriber/Dockerfile | 8 ++------ 4 files changed, 8 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3d832e3e4df..911bdeaa200 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,4 @@ -ARG BUILDPLATFORM="linux/amd64" -ARG BUILDERIMAGE="golang:1.22-bookworm" -# Use distroless as minimal base image to package the manager binary -# 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 golang:1.22-bookworm@sha256:39b7e6ebaca464d51989858871f792f2e186dce8ce0cbdba7e88e4444b244407 AS builder ARG TARGETPLATFORM ARG TARGETOS @@ -24,7 +18,7 @@ COPY . . RUN go build -mod vendor -a -ldflags "${LDFLAGS}" -o manager -FROM $BASEIMAGE +FROM gcr.io/distroless/static-debian12@sha256:8dd8d3ca2cf283383304fd45a5c9c74d5f2cd9da8d3b077d720e264880077c65 WORKDIR / COPY --from=builder /go/src/github.com/open-policy-agent/gatekeeper/manager . diff --git a/gator.Dockerfile b/gator.Dockerfile index 0fba2c5aa64..0d50654f967 100644 --- a/gator.Dockerfile +++ b/gator.Dockerfile @@ -1,10 +1,4 @@ -ARG BUILDPLATFORM="linux/amd64" -ARG BUILDERIMAGE="golang:1.22-bookworm" -# Use distroless as minimal base image to package the manager binary -# 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 golang:1.22-bookworm@sha256:39b7e6ebaca464d51989858871f792f2e186dce8ce0cbdba7e88e4444b244407 AS builder ARG TARGETPLATFORM ARG TARGETOS @@ -23,7 +17,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 gcr.io/distroless/static-debian12@sha256:8dd8d3ca2cf283383304fd45a5c9c74d5f2cd9da8d3b077d720e264880077c65 AS build USER 65532:65532 COPY --from=builder --chown=65532:65532 /gator /gator ENTRYPOINT ["/gator"] diff --git a/test/externaldata/dummy-provider/Dockerfile b/test/externaldata/dummy-provider/Dockerfile index eb498a0e4ea..b6b22dcb71a 100644 --- a/test/externaldata/dummy-provider/Dockerfile +++ b/test/externaldata/dummy-provider/Dockerfile @@ -1,8 +1,4 @@ -ARG BUILDPLATFORM="linux/amd64" -ARG BUILDERIMAGE="golang:1.22-bookworm" -ARG BASEIMAGE="gcr.io/distroless/static-debian12:nonroot" - -FROM --platform=$BUILDPLATFORM $BUILDERIMAGE as builder +FROM --platform=$BUILDPLATFORM golang:1.22-bookworm@sha256:39b7e6ebaca464d51989858871f792f2e186dce8ce0cbdba7e88e4444b244407 as builder ARG TARGETPLATFORM ARG TARGETOS @@ -24,7 +20,7 @@ RUN go mod init && go mod tidy RUN go build -o provider provider.go -FROM $BASEIMAGE +FROM gcr.io/distroless/static-debian12@sha256:8dd8d3ca2cf283383304fd45a5c9c74d5f2cd9da8d3b077d720e264880077c65 WORKDIR / diff --git a/test/pubsub/fake-subscriber/Dockerfile b/test/pubsub/fake-subscriber/Dockerfile index 9a8168a0b3a..05b9cb0e837 100644 --- a/test/pubsub/fake-subscriber/Dockerfile +++ b/test/pubsub/fake-subscriber/Dockerfile @@ -1,8 +1,4 @@ -ARG BUILDPLATFORM="linux/amd64" -ARG BUILDERIMAGE="golang:1.22-bookworm" -ARG BASEIMAGE="gcr.io/distroless/static-debian12:nonroot" - -FROM --platform=$BUILDPLATFORM $BUILDERIMAGE as builder +FROM --platform=$BUILDPLATFORM golang:1.22-bookworm@sha256:39b7e6ebaca464d51989858871f792f2e186dce8ce0cbdba7e88e4444b244407 as builder ARG TARGETPLATFORM ARG TARGETOS @@ -24,7 +20,7 @@ RUN go mod init && go mod tidy && go mod vendor RUN go build -o main -FROM $BASEIMAGE +FROM gcr.io/distroless/static-debian12@sha256:8dd8d3ca2cf283383304fd45a5c9c74d5f2cd9da8d3b077d720e264880077c65 WORKDIR /