support multi-arch builds (#6, thanks @oyvindh)

This commit is contained in:
Eirik Rye 2024-05-02 13:01:58 +02:00
parent 2286b867c1
commit 0a1d03cee9
2 changed files with 13 additions and 3 deletions

View file

@ -1,4 +1,4 @@
FROM golang:1.15.7-alpine AS build_deps
FROM --platform=$BUILDPLATFORM golang:1.15.7-alpine AS build_deps
RUN apk add --no-cache git
@ -13,8 +13,9 @@ RUN go mod download
FROM build_deps AS build
COPY . .
RUN CGO_ENABLED=0 go build -o webhook -ldflags '-w -extldflags "-static"' .
ARG TARGETOS
ARG TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o webhook -ldflags '-w -extldflags "-static"' .
FROM alpine:3.9

View file

@ -35,6 +35,15 @@ docker:
--build-arg "GIT_BRANCH=$(GIT_BRANCH)" \
-t "$(IMAGE_NAME):$(IMAGE_TAG)" .
docker-push:
docker buildx build \
--push \
--build-arg "BUILD_DATE=$(BUILD_DATE)" \
--build-arg "GIT_COMMIT=$(GIT_COMMIT)" \
--build-arg "GIT_BRANCH=$(GIT_BRANCH)" \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
-t "$(IMAGE_NAME):$(IMAGE_TAG)" .
.PHONY: rendered-manifest.yaml
rendered-manifest.yaml:
helm template \