Add commit hash as env variable to docker

This commit is contained in:
Karl Cordes 2019-04-25 14:03:21 +10:00
parent ccd35bc515
commit 77509d6165
3 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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.

View file

@ -172,7 +172,7 @@ endif;
</div>
<div id="footer">
Powered by CMC-Sales v<?= trim(exec('git log --pretty="%h" -n1 HEAD')); ?>
Powered by CMC-Sales <?= $_ENV["COMMIT_SHA"]; ?>
</div>
</div>