Skip to content

Commit

Permalink
Add a new tag with date and git hash
Browse files Browse the repository at this point in the history
Because $version almost never changes, we need an extra tag so that we
can keep history of images on Docker hub and elsewhere.
  • Loading branch information
torsava authored and praiskup committed Apr 4, 2019
1 parent 985b2b0 commit 0fd64b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ for dir in ${VERSIONS}; do
IMAGE_ID=$(cat .image-id)
name=$(docker inspect -f "{{.Config.Labels.name}}" $IMAGE_ID)
version=$(docker inspect -f "{{.Config.Labels.version}}" $IMAGE_ID)
date_and_hash="$(date +%Y%m%d)-$(git rev-parse --short HEAD)"

echo "-> Tagging image '$IMAGE_ID' as '$name:$version' and '$name:latest'"
echo "-> Tagging image '$IMAGE_ID' as '$name:$version' and '$name:latest' and '$name:$date_and_hash'"
docker tag $IMAGE_ID "$name:$version"
docker tag $IMAGE_ID "$name:latest"
docker tag $IMAGE_ID "$name:$date_and_hash"

for suffix in squashed raw; do
id_file=.image-id.$suffix
Expand Down

0 comments on commit 0fd64b8

Please sign in to comment.