Add buildx multi-arch build target to backup/pvc Makefile
Introduce PLATFORMS default (arm64, amd64, s390x, ppc64le) and a docker-buildx target to build and push multi-arch images (IMG=...). The target generates a Dockerfile.cross with platform support, creates and uses a buildx builder, passes UID/GID build args, and cleans up. Mirrors the root Makefile to enable cross-arch image builds. Fixes #1124
This commit is contained in:
parent
bf040e1188
commit
88fda3b143
|
|
@ -186,3 +186,18 @@ endif
|
|||
@echo "Dependencies:"
|
||||
dep status
|
||||
@echo
|
||||
|
||||
# Multi-arch (buildx) support mirroring root Makefile
|
||||
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
|
||||
|
||||
.PHONY: docker-buildx
|
||||
docker-buildx: check-env ## Build and push multi-arch image (set IMG=quay.io/...:tag)
|
||||
@echo "+ $@"
|
||||
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
|
||||
- docker buildx create --name backup-pvc-builder
|
||||
docker buildx use backup-pvc-builder
|
||||
- docker buildx build --push --platform=$(PLATFORMS) \
|
||||
--build-arg UID=$(UID) --build-arg GID=$(GID) \
|
||||
--tag ${IMG} -f Dockerfile.cross .
|
||||
- docker buildx rm backup-pvc-builder
|
||||
rm Dockerfile.cross
|
||||
|
|
|
|||
Loading…
Reference in New Issue