From d4997b07745ff845b080d8efdc43c3b3342f243c Mon Sep 17 00:00:00 2001
From: kaiyou <dev@kaiyou.fr>
Date: Sun, 8 Sep 2024 15:20:24 +0200
Subject: [PATCH] Rewrite the Dockerfile entirely

---
 Dockerfile | 40 +++-------------------------------------
 1 file changed, 3 insertions(+), 37 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 40a46ac8d..f726ec6cb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,42 +1,8 @@
-FROM golang:1.22 AS golangbuild
-ARG TARGETARCH
+FROM golang:1.22
 WORKDIR /usr/src/app
 COPY go.mod go.sum ./
 RUN go mod download && go mod verify
 COPY . .
-RUN make
-
-# This builder stage it's only because we need a command
-# to create a symlink and reduce the size of the image
-FROM gcr.io/distroless/static-debian11:debug-nonroot AS builder
-ARG TARGETARCH
-
-SHELL ["/busybox/sh", "-c"]
-COPY --from=golangbuild --chown=nonroot:nonroot --chmod=0755 /usr/src/app/bin/manager bin/
-RUN ln -sf bin/manager_${TARGETARCH} manager
-
-FROM gcr.io/distroless/static-debian12:nonroot
-ARG VERSION="dev"
-ARG TARGETARCH
-
-ENV SUMMARY="CloudNativePG Operator Container Image." \
-    DESCRIPTION="This Docker image contains CloudNativePG Operator."
-
-LABEL summary="$SUMMARY" \
-      description="$DESCRIPTION" \
-      io.k8s.display-name="$SUMMARY" \
-      io.k8s.description="$DESCRIPTION" \
-      name="CloudNativePG Operator" \
-      vendor="CloudNativePG Contributors" \
-      url="https://cloudnative-pg.io/" \
-      version="$VERSION" \
-      release="1"
-
-WORKDIR /
-
-# Needs to copy the entire content, otherwise, it will not
-# copy the symlink properly.
-COPY --from=builder /home/nonroot/ .
-USER 65532:65532
-
+RUN make build \
+ && mv bin/manager /
 ENTRYPOINT ["/manager"]
-- 
GitLab