From 0d259384a0d211e6fc9092ea2fe6ec00d767de56 Mon Sep 17 00:00:00 2001
From: battlmonstr <battlmonstr@users.noreply.github.com>
Date: Wed, 25 May 2022 03:12:40 +0200
Subject: [PATCH] CI (#3779): pass docker build arguments on Docker Hub (#4252)

---
 Makefile            | 2 +-
 hooks/build         | 8 ++++++++
 hooks/post_checkout | 0
 3 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100755 hooks/build
 mode change 100644 => 100755 hooks/post_checkout

diff --git a/Makefile b/Makefile
index 4f6e7ef8f0..aae5e0391c 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ GOBIN = $(CURDIR)/build/bin
 
 GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
 GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
-GIT_TAG    ?= $(shell git describe --tags --dirty)
+GIT_TAG    ?= $(shell git describe --tags '--match=v*' --dirty)
 
 CGO_CFLAGS := $(shell $(GO) env CGO_CFLAGS) # don't loose default
 CGO_CFLAGS += -DMDBX_FORCE_ASSERTIONS=1 # Enable MDBX's asserts by default in 'devel' branch and disable in 'stable'
diff --git a/hooks/build b/hooks/build
new file mode 100755
index 0000000000..b5a49356f1
--- /dev/null
+++ b/hooks/build
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# This is needed to pass build ARGs to Dockerfile.
+# see https://docs.docker.com/docker-hub/builds/advanced/
+
+DOCKER_FLAGS="-t $IMAGE_NAME" \
+GIT_TAG=$(git describe --tags '--match=v*' --dirty) \
+    make docker
diff --git a/hooks/post_checkout b/hooks/post_checkout
old mode 100644
new mode 100755
-- 
GitLab