From e5e6220998ec864f574b6497637eaabb2708ea4f Mon Sep 17 00:00:00 2001
From: Cyril Levis <git@levis.name>
Date: Wed, 21 Aug 2024 23:15:40 +0200
Subject: [PATCH] fix: custom Dockerfile

---
 Dockerfile | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index c96d23236..40a46ac8d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,18 @@
+FROM golang:1.22 AS golangbuild
+ARG TARGETARCH
+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-debian12:debug-nonroot AS builder
+FROM gcr.io/distroless/static-debian11:debug-nonroot AS builder
 ARG TARGETARCH
 
 SHELL ["/busybox/sh", "-c"]
-COPY --chown=nonroot:nonroot --chmod=0755 dist/manager/* bin/
+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
-- 
GitLab