From a3f312257b1683db670696098e4e8cab65a01c33 Mon Sep 17 00:00:00 2001
From: Jacob Weinstock <jakobweinstock@gmail.com>
Date: Sat, 14 Jan 2023 15:16:16 -0700
Subject: [PATCH] Get Dockerfile env vars properly working:

The TARGETARCH and TARGETOS env vars weren't making
it to the `go build` command so the GOOS and GOARCH
were would be empty and the build would only use amd64.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
---
 Dockerfile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Dockerfile b/Dockerfile
index 087ee8a..39008ad 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,6 +13,12 @@ RUN go mod download
 # Copy the go source
 COPY ./ ./
 
+# Define args for the target platform so we can identify the binary in the Docker context.
+# These args are populated by Docker. The values should match Go's GOOS and GOARCH values for
+# the respective os/platform.
+ARG TARGETARCH
+ARG TARGETOS
+
 # Build
 RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -o manager main.go