core-controllers: multi-arch container images
diff --git a/core/headscale/controller/Dockerfile b/core/headscale/controller/Dockerfile
index b3158b2..b549ffe 100644
--- a/core/headscale/controller/Dockerfile
+++ b/core/headscale/controller/Dockerfile
@@ -1,27 +1,28 @@
-# Build the manager binary
-FROM golang:1.18 as builder
+# # Build the manager binary
+# FROM golang:1.18 as builder
 
-WORKDIR /workspace
-# Copy the Go Modules manifests
-COPY go.mod go.mod
-COPY go.sum go.sum
-# cache deps before building and copying source so that we don't need to re-download as much
-# and so that source changes don't invalidate our downloaded layer
-RUN go mod download
+# WORKDIR /workspace
+# # Copy the Go Modules manifests
+# COPY go.mod go.mod
+# COPY go.sum go.sum
+# # cache deps before building and copying source so that we don't need to re-download as much
+# # and so that source changes don't invalidate our downloaded layer
+# RUN go mod download
 
-# Copy the go source
-COPY main.go main.go
-COPY api/ api/
-COPY controllers/ controllers/
+# # Copy the go source
+# COPY main.go main.go
+# COPY api/ api/
+# COPY controllers/ controllers/
 
-# Build
-RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o manager main.go
+# # Build
+# RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o manager main.go
 
-# Use distroless as minimal base image to package the manager binary
-# Refer to https://github.com/GoogleContainerTools/distroless for more details
+# # Use distroless as minimal base image to package the manager binary
+# # Refer to https://github.com/GoogleContainerTools/distroless for more details
 FROM gcr.io/distroless/static:nonroot
+ARG TARGETARCH
 WORKDIR /
-COPY --from=builder /workspace/manager .
+COPY manager_${TARGETARCH} manager
 USER 65532:65532
 
 ENTRYPOINT ["/manager"]
diff --git a/core/headscale/controller/Makefile b/core/headscale/controller/Makefile
index e1f6077..d32e0e4 100644
--- a/core/headscale/controller/Makefile
+++ b/core/headscale/controller/Makefile
@@ -68,13 +68,35 @@
 run: manifests generate fmt vet ## Run a controller from your host.
 	go run ./main.go --headscale-api=localhost:8081
 
+clean:
+	rm -rf manager_arm64 manager_amd64
+
+build_arm64: export CGO_ENABLED=0
+build_arm64: export GO111MODULE=on
+build_arm64: export GOOS=linux
+build_arm64: export GOARCH=arm64
+build_arm64:
+	go build -a -o manager_arm64 main.go
+
+build_amd64: export CGO_ENABLED=0
+build_amd64: export GO111MODULE=on
+build_amd64: export GOOS=linux
+build_amd64: export GOARCH=amd64
+build_amd64:
+	go build -a -o manager_amd64 main.go
+
 .PHONY: docker-build
-docker-build: test ## Build docker image with the manager.
-	podman build -t ${IMG} .
+docker-build: test clean build_arm64 build_amd64 ## Build docker image with the manager.
+	podman build --platform linux/arm64 --tag ${IMG}-arm64 .
+	podman build --platform linux/amd64 --tag ${IMG}-amd64 .
 
 .PHONY: docker-push
 docker-push: ## Push docker image with the manager.
-	podman push ${IMG}
+	podman push ${IMG}-arm64
+	podman push ${IMG}-amd64
+	podman manifest create ${IMG} ${IMG}-arm64 ${IMG}-amd64
+	podman manifest push ${IMG} docker://docker.io/${IMG}
+	podman manifest rm ${IMG}
 
 ##@ Deployment
 
diff --git a/core/resource-renderer/Dockerfile b/core/resource-renderer/Dockerfile
index c4ac419..5f6e395 100644
--- a/core/resource-renderer/Dockerfile
+++ b/core/resource-renderer/Dockerfile
@@ -1,29 +1,30 @@
-# Build the manager binary
-FROM golang:1.18 as builder
+# # Build the manager binary
+# FROM golang:1.18 as builder
 
-ARG TARGETARCH
+# ARG TARGETARCH
 
-WORKDIR /workspace
-# Copy the Go Modules manifests
-COPY go.mod go.mod
-COPY go.sum go.sum
-# cache deps before building and copying source so that we don't need to re-download as much
-# and so that source changes don't invalidate our downloaded layer
-RUN go mod download
+# WORKDIR /workspace
+# # Copy the Go Modules manifests
+# COPY go.mod go.mod
+# COPY go.sum go.sum
+# # cache deps before building and copying source so that we don't need to re-download as much
+# # and so that source changes don't invalidate our downloaded layer
+# RUN go mod download
 
-# Copy the go source
-COPY main.go main.go
-COPY api/ api/
-COPY controllers/ controllers/
+# # Copy the go source
+# COPY main.go main.go
+# COPY api/ api/
+# COPY controllers/ controllers/
 
-# Build
-RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o manager main.go
+# # Build
+# RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o manager main.go
 
-# Use distroless as minimal base image to package the manager binary
-# Refer to https://github.com/GoogleContainerTools/distroless for more details
+# # Use distroless as minimal base image to package the manager binary
+# # Refer to https://github.com/GoogleContainerTools/distroless for more details
 FROM gcr.io/distroless/static:nonroot
+ARG TARGETARCH
 WORKDIR /
-COPY --from=builder /workspace/manager .
+COPY manager_${TARGETARCH} manager
 USER 65532:65532
 
 ENTRYPOINT ["/manager"]
diff --git a/core/resource-renderer/Makefile b/core/resource-renderer/Makefile
index d9ba93b..5b9dda4 100644
--- a/core/resource-renderer/Makefile
+++ b/core/resource-renderer/Makefile
@@ -68,13 +68,36 @@
 run: manifests generate fmt vet ## Run a controller from your host.
 	go run ./main.go
 
+clean:
+	rm -rf manager_arm64 manager_amd64
+
+build_arm64: export CGO_ENABLED=0
+build_arm64: export GO111MODULE=on
+build_arm64: export GOOS=linux
+build_arm64: export GOARCH=arm64
+build_arm64:
+	go build -a -o manager_arm64 main.go
+
+build_amd64: export CGO_ENABLED=0
+build_amd64: export GO111MODULE=on
+build_amd64: export GOOS=linux
+build_amd64: export GOARCH=amd64
+build_amd64:
+	go build -a -o manager_amd64 main.go
+
+
 .PHONY: docker-build
-docker-build: test ## Build docker image with the manager.
-	podman build -t ${IMG} .
+docker-build: test clean build_arm64 build_amd64 ## Build docker image with the manager.
+	podman build --platform linux/arm64 --tag ${IMG}-arm64 .
+	podman build --platform linux/amd64 --tag ${IMG}-amd64 .
 
 .PHONY: docker-push
 docker-push: ## Push docker image with the manager.
-	podman push ${IMG}
+	podman push ${IMG}-arm64
+	podman push ${IMG}-amd64
+	podman manifest create ${IMG} ${IMG}-arm64 ${IMG}-amd64
+	podman manifest push ${IMG} docker://docker.io/${IMG}
+	podman manifest rm ${IMG}
 
 ##@ Deployment