#! /bin/bash

# Generate a uniq id for the build. This is added to the code in the docker build.
# The git short sha and millis to ensure unique each time the build is run.
# The sha prefix is useful for comparing to what has been committed in code.

SHA=`git rev-parse --short HEAD`
let TIMESUFFIX="`date +%s`  % 1000000"

echo '# This file is created automatically in makebuildsha.sh' > docker/buildsha.py
echo "sha=\"${SHA}_${TIMESUFFIX}\"" >> docker/buildsha.py

python -c 'from docker import buildsha; print(buildsha.sha)'
