Highlight uncommitted changes in version

If there are uncommitted changes in the app repository when building,
then append `_uncommitted_<random>` to it to distinguish the image
from one built from a clean checkout.

Also change the version used when renaming a container on redeploy to
distinguish and explain the version suffixes.
This commit is contained in:
Donal McBreen
2023-05-11 16:14:41 +01:00
parent 15e8ac0ced
commit a5ef1f254f
9 changed files with 34 additions and 12 deletions

View File

@@ -23,7 +23,6 @@ RUN mkdir -p /etc/docker/certs.d/registry:4443 && ln -s /shared/certs/domain.crt
RUN git config --global user.email "deployer@example.com"
RUN git config --global user.name "Deployer"
RUN git init && git add . && git commit -am "Initial version"
RUN git rev-parse HEAD > version
HEALTHCHECK --interval=1s CMD pgrep sleep

View File

@@ -1,4 +1,7 @@
FROM nginx:1-alpine-slim
COPY default.conf /etc/nginx/conf.d/default.conf
COPY version /usr/share/nginx/html/version
ARG COMMIT_SHA
RUN echo $COMMIT_SHA > /usr/share/nginx/html/version

View File

@@ -9,6 +9,8 @@ registry:
password: root
builder:
multiarch: false
args:
COMMIT_SHA: <%= `git rev-parse HEAD` %>
healthcheck:
cmd: wget -qO- http://localhost > /dev/null
traefik:

View File

@@ -1,4 +1,3 @@
#!/bin/bash
git commit -am 'Update rev' --amend
git rev-parse HEAD > version