From 77509d61653727dcfe27b3cd173c152df25ad77f Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Thu, 25 Apr 2019 14:03:21 +1000 Subject: [PATCH] Add commit hash as env variable to docker --- .gitlab-ci.yml | 2 +- Dockerfile | 2 ++ app/views/layouts/default.ctp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 47906f1c..3bd88e96 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ stages: build: stage: build script: - - docker build . -t "cmc:latest" + - docker build --build-arg=COMMIT=$(git rev-parse --short HEAD) . -t "cmc:latest" deploy_staging: stage: deploy diff --git a/Dockerfile b/Dockerfile index d4ec656d..6019ff6a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,8 @@ ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_LOCK_DIR /var/lock/apache2 ENV APACHE_PID_FILE /var/run/apache2.pid +ENV COMMIT_SHA=${COMMIT} + EXPOSE 80 # Copy site into place. diff --git a/app/views/layouts/default.ctp b/app/views/layouts/default.ctp index f29a23da..c44f6dfd 100755 --- a/app/views/layouts/default.ctp +++ b/app/views/layouts/default.ctp @@ -172,7 +172,7 @@ endif;