From 027d50fc105fd527dca0bf56fe51b7240f119e66 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Tue, 12 Mar 2024 16:53:36 +0000 Subject: [PATCH] feat(ci): tag docker image as latest only for beta (#7103) --- .github/workflows/docker.yml | 6 +++++- Makefile | 22 +++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 05cba3e21..1fb89f7c1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -36,5 +36,9 @@ jobs: run: | docker run --privileged --rm tonistiigi/binfmt --install arm64,amd64 docker buildx create --use --name cross-builder + - name: Build and push image, tag as "latest" + if: ${{ contains(github.event.ref, 'beta') }} + run: make PROFILE=maxperf docker-build-push-latest - name: Build and push image - run: make PROFILE=maxperf docker-build-latest + if: ${{ ! contains(github.event.ref, 'beta') }} + run: make PROFILE=maxperf docker-build-push diff --git a/Makefile b/Makefile index d1fb5d7f5..42fe1303e 100644 --- a/Makefile +++ b/Makefile @@ -183,20 +183,28 @@ ef-tests: $(EF_TESTS_DIR) ## Runs Ethereum Foundation tests. # # `docker run --privileged --rm tonistiigi/binfmt --install amd64,arm64` # `docker buildx create --use --driver docker-container --name cross-builder` -.PHONY: docker-build-latest -docker-build-latest: ## Build and push a cross-arch Docker image tagged with the latest git tag and `latest`. - $(call build_docker_image,$(GIT_TAG),latest) +.PHONY: docker-build-push +docker-build-push: ## Build and push a cross-arch Docker image tagged with the latest git tag. + $(call docker_build_push,$(GIT_TAG),$(GIT_TAG)) + +# Note: This requires a buildx builder with emulation support. For example: +# +# `docker run --privileged --rm tonistiigi/binfmt --install amd64,arm64` +# `docker buildx create --use --driver docker-container --name cross-builder` +.PHONY: docker-build-push-latest +docker-build-push-latest: ## Build and push a cross-arch Docker image tagged with the latest git tag and `latest`. + $(call docker_build_push,$(GIT_TAG),latest) # Note: This requires a buildx builder with emulation support. For example: # # `docker run --privileged --rm tonistiigi/binfmt --install amd64,arm64` # `docker buildx create --use --name cross-builder` -.PHONY: docker-build-nightly -docker-build-nightly: ## Build and push cross-arch Docker image tagged with the latest git tag with a `-nightly` suffix, and `latest-nightly`. - $(call build_docker_image,$(GIT_TAG)-nightly,latest-nightly) +.PHONY: docker-build-push-nightly +docker-build-push-nightly: ## Build and push cross-arch Docker image tagged with the latest git tag with a `-nightly` suffix, and `latest-nightly`. + $(call docker_build_push,$(GIT_TAG)-nightly,latest-nightly) # Create a cross-arch Docker image with the given tags and push it -define build_docker_image +define docker_build_push $(MAKE) build-x86_64-unknown-linux-gnu mkdir -p $(BIN_DIR)/amd64 cp $(BUILD_PATH)/x86_64-unknown-linux-gnu/$(PROFILE)/reth $(BIN_DIR)/amd64/reth