clear and set the buildx context on push. Then use --push with buildx build to push the multi-arch images immediately after creating them. This gets around the need to store them locally (which won't work for something like an M1 mac).
25 lines
601 B
Makefile
25 lines
601 B
Makefile
.PHONY: docker-init
|
|
docker-init:
|
|
@touch VERSION
|
|
@touch IMAGE
|
|
|
|
.PHONY: buildx-context
|
|
buildx-context:
|
|
docker buildx create --name container-builder --use --platform linux/amd64,linux/arm64
|
|
|
|
.PHONY: buildx-clear
|
|
buildx-clear:
|
|
docker buildx rm container-builder
|
|
|
|
.PHONY: build
|
|
build:
|
|
docker buildx build --load . -t $(IMAGE)
|
|
@docker buildx build --load . -t $(IMAGE_LATEST)
|
|
|
|
.PHONY: push
|
|
push:
|
|
-make buildx-clear
|
|
@make buildx-context
|
|
docker buildx build --platform linux/amd64,linux/arm64 --push . -t $(IMAGE)
|
|
@docker buildx build --platform linux/amd64,linux/arm64 --push . -t $(IMAGE_LATEST)
|