From 5ec52c6a4482cffbd4346a5d5b0ac74737b7cc36 Mon Sep 17 00:00:00 2001
From: Cyril Levis <git@levis.name>
Date: Wed, 21 Aug 2024 22:59:41 +0200
Subject: [PATCH] fix: custom Dockerfile

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

diff --git a/Dockerfile b/Dockerfile
index 54eee5727..dc81ce23a 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-debian11: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-debian11:nonroot
-- 
GitLab