From 23ac2b6c9fee1822d05db61b95580a97ce344f01 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Sun, 23 Feb 2020 21:04:47 +0100 Subject: [PATCH] Allow to override build date with SOURCE_DATE_EPOCH in order to make builds reproducible. See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. Also use UTC to be independent of timezone. This variant only works with GNU date. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4685f5b8..82844c89 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ NAME := k9s PACKAGE := github.com/derailed/$(NAME) GIT := $(shell git rev-parse --short HEAD) -DATE := $(shell date +%FT%T%Z) +SOURCE_DATE_EPOCH ?= $(shell date +%s) +DATE := $(shell date -u -d @${SOURCE_DATE_EPOCH} +%FT%T%Z) VERSION ?= v0.14.0 IMG_NAME := derailed/k9s IMAGE := ${IMG_NAME}:${VERSION}