From 3ec2275ae839e1452350475d5d26e1b6c655abe2 Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Tue, 16 Jul 2019 12:54:02 +0200 Subject: [PATCH 1/2] :construction_worker: Dockerhub build hook Signed-off-by: mathieu.brunot --- ecs/hooks/build | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 ecs/hooks/build diff --git a/ecs/hooks/build b/ecs/hooks/build new file mode 100644 index 0000000..55bb278 --- /dev/null +++ b/ecs/hooks/build @@ -0,0 +1,9 @@ +#!/bin/bash + +# See documentation for details: +# https://docs.docker.com/docker-hub/builds/advanced/ + +# Use $VERSION build environment variable or the Docker repository tag being built +version=${VERSION:-${DOCKER_TAG}} + +docker build --build-arg VERSION=$version -f $DOCKERFILE_PATH -t $IMAGE_NAME . \ No newline at end of file From 4a27d2d9bd05a2fd144609d80bddc8acfdb1de2a Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Tue, 30 Jul 2019 19:12:42 +0200 Subject: [PATCH 2/2] :sparkles: Update labels in hook after #40 merged Signed-off-by: mathieu.brunot --- ecs/hooks/build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ecs/hooks/build b/ecs/hooks/build index 55bb278..732f79c 100644 --- a/ecs/hooks/build +++ b/ecs/hooks/build @@ -6,4 +6,9 @@ # Use $VERSION build environment variable or the Docker repository tag being built version=${VERSION:-${DOCKER_TAG}} -docker build --build-arg VERSION=$version -f $DOCKERFILE_PATH -t $IMAGE_NAME . \ No newline at end of file +docker build \ + --build-arg VERSION=$version \ + --build-arg VCS_REF=`git rev-parse --short HEAD` \ + --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ + -f $DOCKERFILE_PATH \ + -t $IMAGE_NAME .