Skip to content

Instantly share code, notes, and snippets.

@bcho
Created August 22, 2019 13:58
Show Gist options
  • Save bcho/380b4ada0af1b8e059637074f166caee to your computer and use it in GitHub Desktop.
Save bcho/380b4ada0af1b8e059637074f166caee to your computer and use it in GitHub Desktop.
docker image building with semantic tag
#!/usr/bin/bash
set -e
TAG="$1"
if [[ -z "$TAG" ]]
then
date_version=$(date "+%Y%m%d")
head_commit=$(git rev-parse --short HEAD)
TAG="${date_version}-${head_commit}"
fi
docker build \
-t cool-project:"${TAG}" \
-f docker/Dockerfile \
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment