Skip to content

Commit

Permalink
simplify + build_sha
Browse files Browse the repository at this point in the history
  • Loading branch information
jpinsonneau committed Mar 2, 2023
1 parent bb98ff5 commit a37d7c3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,22 @@ push:

single-multiarch-linux/%:
#The --load option is ignored by podman but required for docker
DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --load --build-arg TARGETPLATFORM=linux/$* --build-arg TARGETARCH=$* --build-arg BUILDPLATFORM=linux/amd64 -t $(BASE_IMAGE):$(TAG)-$* -f Dockerfile .
DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --load --build-arg TARGETPLATFORM=linux/$* --build-arg TARGETARCH=$* --build-arg BUILDPLATFORM=linux/amd64 -t $(IMAGE)-$* -f Dockerfile .

push-single-multiarch-linux/%: single-multiarch-linux/%
DOCKER_BUILDKIT=1 $(OCI_BIN) push $(BASE_IMAGE):$(TAG)-$*
DOCKER_BUILDKIT=1 $(OCI_BIN) push $(IMAGE)-$*

.PHONY: multiarch-manifest
multiarch-manifest: push-single-multiarch-linux/amd64 push-single-multiarch-linux/arm64 push-single-multiarch-linux/ppc64le
DOCKER_BUILDKIT=1 $(OCI_BIN) manifest create $(BASE_IMAGE):$(TAG) --amend $(BASE_IMAGE):$(TAG)-amd64 --amend $(BASE_IMAGE):$(TAG)-arm64 --amend $(BASE_IMAGE):$(TAG)-ppc64le
DOCKER_BUILDKIT=1 $(OCI_BIN) manifest create $(IMAGE) --amend $(IMAGE)-amd64 --amend $(IMAGE)-arm64 --amend $(IMAGE)-ppc64le

.PHONY: push-multiarch-manifest
push-multiarch-manifest: multiarch-manifest
@echo 'publish manifest $(TAG) to $(BASE_IMAGE)'
ifeq (${OCI_BIN} , docker)
DOCKER_BUILDKIT=1 $(OCI_BIN) manifest push $(BASE_IMAGE):$(TAG)
DOCKER_BUILDKIT=1 $(OCI_BIN) manifest push $(IMAGE)
else
DOCKER_BUILDKIT=1 $(OCI_BIN) manifest push $(BASE_IMAGE):$(TAG) docker://$(BASE_IMAGE):$(TAG)
DOCKER_BUILDKIT=1 $(OCI_BIN) manifest push $(IMAGE) docker://$(IMAGE)
endif

.PHONY: build-ci-images
Expand All @@ -154,10 +154,10 @@ endif

.PHONY: push-ci-images
push-ci-images:
DOCKER_BUILDKIT=1 $(OCI_BIN) push $(BASE_IMAGE):$(COMMIT)
DOCKER_BUILDKIT=1 $(OCI_BIN) push $(BASE_IMAGE):$(BUILD_SHA)
ifeq ($(TAG), main)
# Also tag "latest" only for branch "main"
DOCKER_BUILDKIT=1 $(OCI_BIN) push $(BASE_IMAGE):$(TAG)
DOCKER_BUILDKIT=1 $(OCI_BIN) push $(IMAGE)
DOCKER_BUILDKIT=1 $(OCI_BIN) push $(BASE_IMAGE):latest
endif

Expand Down

0 comments on commit a37d7c3

Please sign in to comment.