Skip to content

Commit

Permalink
Add multi-arch image builds to makefile
Browse files Browse the repository at this point in the history
A default set of platforms is specified and will build those if var `PLATFORMS` is not specified on the CLI

Issue ansible#31 fixes ansible#1680
  • Loading branch information
jon-nfc committed Jan 8, 2024
1 parent 07427be commit ff16db8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ docker-build: ## Build docker image with the manager.
docker-push: ## Push docker image with the manager.
${CONTAINER_CMD} push ${IMG}

# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> than the export will fail)
# To properly provided solutions that supports more than one platform you should use this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
docker-buildx: ## Build and push docker image for the manager for cross-platform support
- docker buildx create --name project-v3-builder
docker buildx use project-v3-builder
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
- docker buildx rm project-v3-builder


##@ Deployment

.PHONY: install
Expand Down

0 comments on commit ff16db8

Please sign in to comment.