File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 11# Build the manager binary
2- FROM golang:1.24-alpine AS builder
2+ FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
33
44WORKDIR /workspace
55# Copy the Go Modules manifests
@@ -16,7 +16,9 @@ COPY apis/ apis/
1616COPY controllers/ controllers/
1717
1818# Build
19- RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o flink-operator main.go
19+ ARG TARGETOS
20+ ARG TARGETARCH
21+ RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -o flink-operator main.go
2022
2123# Use distroless as minimal base image to package the manager binary
2224# Refer to https://github.com/GoogleContainerTools/distroless for more details
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ SHELL := /bin/bash
22VERSION ?= latest
33# Image URL to use all building/pushing image targets
44IMG ?= ghcr.io/spotify/flink-operator:$(VERSION )
5+ # Image platforms to support.
6+ PLATFORMS ?= linux/amd64,linux/arm64
57# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
68CRD_OPTIONS ?= "crd:maxDescLen=0,generateEmbeddedObjectMeta=true"
79# The Kubernetes namespace in which the operator will be deployed.
@@ -98,11 +100,15 @@ endif
98100run : manifests generate fmt vet tidy # # Run a controller from your host against the configured Kubernetes cluster in ~/.kube/config
99101 go run ./main.go
100102
101- docker-build : test # # Build docker image with the manager.
102- docker build -t ${IMG} --label git-commit=$(shell git rev-parse HEAD) .
103+ .PHONY : docker-create-builder # # Create makes a new builder instance.
104+ docker-create-builder :
105+ docker buildx create --use
103106
104- docker-push : docker-build # # Push docker image with the manager.
105- docker push ${IMG}
107+ docker-build : test docker-create-builder # # Build docker image with the manager.
108+ docker buildx build --platform ${PLATFORMS} -t ${IMG} --label git-commit=$(shell git rev-parse HEAD) .
109+
110+ docker-push : test docker-create-builder # # Push docker image with the manager.
111+ docker buildx build --push --platform ${PLATFORMS} -t ${IMG} --label git-commit=$(shell git rev-parse HEAD) .
106112
107113release-manifests : build-overlay build-overlay-sharded # # Build manifests for release.
108114 $(KUSTOMIZE ) build config/deploy > config/deploy/flink-operator.yaml \
You can’t perform that action at this time.
0 commit comments