Skip to content

Commit

Permalink
Use buildx to support multiarch images
Browse files Browse the repository at this point in the history
  • Loading branch information
lexbritvin committed May 10, 2023
1 parent 4255bb2 commit 74f4f54
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TAGS ?= 81 81-fpm 81-unit 82 82-fpm 82-unit
COMPOSER_HASH ?= 55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae
DRUSH_VERSION ?= 8.4.12
DOCKER_BUILDKIT ?= 1
PLATFORM ?= linux/amd64
PLATFORM ?= linux/amd64,linux/arm64

.PHONY: all build push

Expand All @@ -14,7 +14,6 @@ build:
@echo "Building images for tags: $(TAGS)"
set -e; for i in $(TAGS); do printf "\nBuilding $(NAME):$$i \n\n"; cd php$$i; \
DOCKER_BUILDKIT=$(DOCKER_BUILDKIT) docker build -t $(NAME):$$i \
--platform $(PLATFORM) \
--no-cache --progress=plain \
--build-arg COMPOSER_HASH=$(COMPOSER_HASH) \
--build-arg DRUSH_VERSION=$(DRUSH_VERSION) \
Expand All @@ -28,3 +27,15 @@ push:

unit:
make -C unit-php-builder/dev build

buildx-push:
@echo "Building and pushing images for tags: $(TAGS)"
set -e; for i in $(TAGS); do printf "\nBuilding $(NAME):$$i \n\n"; cd php$$i; \
docker buildx build -t $(NAME):$$i --push \
--platform $(PLATFORM) \
--no-cache --progress=plain \
--build-arg COMPOSER_HASH=$(COMPOSER_HASH) \
--build-arg DRUSH_VERSION=$(DRUSH_VERSION) \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` .; \
cd ..; done

0 comments on commit 74f4f54

Please sign in to comment.