From 31ea5eeeb23c1e579cde1bc1ac189e90a3354530 Mon Sep 17 00:00:00 2001 From: nbykov0 <166552198+nbykov0@users.noreply.github.com> Date: Mon, 12 May 2025 03:06:57 +0300 Subject: [PATCH] system/kubeovn-webhook: multiarch support Signed-off-by: nbykov0 <166552198+nbykov0@users.noreply.github.com> --- packages/system/kubeovn-webhook/Makefile | 2 ++ .../kubeovn-webhook/images/kubeovn-webhook/Dockerfile | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/system/kubeovn-webhook/Makefile b/packages/system/kubeovn-webhook/Makefile index 2605ca5e..76bf5f5a 100644 --- a/packages/system/kubeovn-webhook/Makefile +++ b/packages/system/kubeovn-webhook/Makefile @@ -7,6 +7,8 @@ include ../../../scripts/package.mk image: docker buildx build images/kubeovn-webhook \ --provenance false \ + --builder=$(BUILDER) \ + --platform=$(PLATFORM) \ --tag $(REGISTRY)/kubeovn-webhook:$(call settag,$(TAG)) \ --cache-from type=registry,ref=$(REGISTRY)/kubeovn-webhook:latest \ --cache-to type=inline \ diff --git a/packages/system/kubeovn-webhook/images/kubeovn-webhook/Dockerfile b/packages/system/kubeovn-webhook/images/kubeovn-webhook/Dockerfile index 337e72e4..73d5e99b 100644 --- a/packages/system/kubeovn-webhook/images/kubeovn-webhook/Dockerfile +++ b/packages/system/kubeovn-webhook/images/kubeovn-webhook/Dockerfile @@ -1,11 +1,14 @@ -FROM golang:1.23 as builder +FROM golang:1.23 AS builder + +ARG TARGETOS +ARG TARGETARCH WORKDIR /app COPY go.mod go.sum ./ -RUN go mod download +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go mod download COPY . . -RUN CGO_ENABLED=0 GOOS=linux go build -o webhook . +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o webhook . FROM alpine:3.21.3 WORKDIR /app