-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support multiarch image build and push
Add docker-build-multiarch/docker-push-multiarch in Makefile Signed-off-by: roc <[email protected]>
- Loading branch information
Showing
2 changed files
with
15 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
|
||
# Image URL to use all building/pushing images targets | ||
IMG ?= kruise-game-manager:test | ||
IMAGE_PLATFORMS ?= linux_amd64 linux_arm64 | ||
# Convert to linux/arm64,linux/amd64 | ||
$(eval BUILDX_PLATFORMS = $(shell echo "${IMAGE_PLATFORMS}" | sed "s# #,#;s#_#/#g")) | ||
|
||
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. | ||
ENVTEST_K8S_VERSION = 1.24.1 | ||
|
||
|
@@ -77,6 +81,14 @@ docker-build: ## Build docker images with the manager. | |
docker-push: ## Push docker images with the manager. | ||
docker push ${IMG} | ||
|
||
.PHONY: docker-build-multiarch | ||
docker-build-multiarch: ## Build multiarch docker images with the manager. | ||
docker buildx build --platform "${BUILDX_PLATFORMS}" -t ${IMG} . | ||
|
||
.PHONY: docker-push-multiarch | ||
docker-push-multiarch: ## Push multiarch docker images with the manager. | ||
docker buildx build --push --sbom=false --provenance=false --platform "${BUILDX_PLATFORMS}" -t ${IMG} . | ||
|
||
##@ Deployment | ||
|
||
ifndef ignore-not-found | ||
|
@@ -137,4 +149,4 @@ helm: ## Download helm locally if necessary. | |
$(call go-get-tool,$(HELM),helm.sh/helm/[email protected]) | ||
|
||
ginkgo: ## Download ginkgo locally if necessary. | ||
GOBIN=$(LOCALBIN) go install github.com/onsi/ginkgo/[email protected] | ||
GOBIN=$(LOCALBIN) go install github.com/onsi/ginkgo/[email protected] |