Skip to content

Commit

Permalink
use docker build instead of buildx for multi-arch
Browse files Browse the repository at this point in the history
  • Loading branch information
deviantony committed Oct 13, 2024
1 parent 45bdec3 commit 52399cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# Note: these can be overriden on the command line e.g. `make VERSION=2024.10`
VERSION=2024.10

.PHONY: setup clean base alapenna
.PHONY: base-amd64 base-arm64 base alapenna

setup:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch --driver docker-container --use
docker buildx inspect --bootstrap

clean:
docker buildx rm multiarch
base-amd64:
docker build --push --platform=linux/amd64 -t portainer/dev-toolkit:$(VERSION)-amd64 -f Dockerfile .

base: setup
docker buildx build --push --platform=linux/arm64,linux/amd64 -t portainer/dev-toolkit:$(VERSION) -f Dockerfile .
base-arm64:
docker build --push --platform=linux/arm64 -t portainer/dev-toolkit:$(VERSION)-arm64 -f Dockerfile .

alapenna:
# Note: buildx sucks for multi-arch: https://skyworkz.nl/blog/multi-arch-docker-image-10x-faster
base: base-amd64 base-arm64
docker manifest create \
portainer/dev-toolkit:$(VERSION) \
portainer/dev-toolkit:$(VERSION)-amd64 \
portainer/dev-toolkit:$(VERSION)-arm64
docker manifest push portainer/dev-toolkit:$(VERSION)

alapenna: base
docker buildx build --no-cache --load -t portainer-dev-toolkit:alapenna -f user-toolkits/alapenna/Dockerfile .
10 changes: 4 additions & 6 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch --driver docker-container --use
docker buildx inspect --bootstrap

docker buildx build --push --platform=linux/arm64,linux/amd64 -t "$IMAGE_NAME" -f "$DOCKERFILE_PATH" .
docker build --push --platform=linux/amd64 -t "$IMAGE_NAME-amd64" -f "$DOCKERFILE_PATH" .
docker build --push --platform=linux/arm64 -t "$IMAGE_NAME-arm64" -f "$DOCKERFILE_PATH" .
docker manifest create "$IMAGE_NAME" "$IMAGE_NAME-amd64" "$IMAGE_NAME-arm64"
docker manifest push "$IMAGE_NAME"

0 comments on commit 52399cb

Please sign in to comment.