From 1b2bf8bf61dc4c3fbf6c06e1e6718997b6f91a0a Mon Sep 17 00:00:00 2001 From: Igor Mandrigin Date: Fri, 30 Oct 2020 09:43:24 +0100 Subject: [PATCH] fix git commit when using `make docker` (#1323) * fix git commit when using `make docker` * avoid warning about LATEST_COMMIT for linters in Docker --- Dockerfile | 6 ++++++ Makefile | 7 ++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3820fbb95..5ef6171d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,11 @@ FROM golang:1.15-alpine3.12 as builder +ARG git_commit +ENV GIT_COMMIT=$git_commit + +# for linters to avoid warnings. we won't use linters in Docker anyway +ENV LATEST_COMMIT="undefined" + RUN apk --no-cache add make gcc g++ linux-headers git bash ca-certificates libgcc libstdc++ WORKDIR /app diff --git a/Makefile b/Makefile index c268aca2f..245923ef2 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ ifeq ($(LATEST_COMMIT),) LATEST_COMMIT := $(shell git log -n 1 HEAD~1 --pretty=format:"%H") endif -GIT_COMMIT=$(shell git rev-list -1 HEAD) +GIT_COMMIT ?= $(shell git rev-list -1 HEAD) OS = $(shell uname -s) ARCH = $(shell uname -m) @@ -22,10 +22,7 @@ endif all: tg hack tester rpctest state pics rpcdaemon integration db-tools docker: - docker build -t turbo-geth:latest . - -docker-alltools: - docker build -t turbo-geth-alltools:latest -f Dockerfile.alltools . + docker build -t turbo-geth:latest --build-arg git_commit='${GIT_COMMIT}' . docker-compose: docker-compose up