This patch automatically downloads latest tagged version. With this, we don't have to update the previous TAG arguments to update the image. We can override the version download with the argument VERSION.
if [ "${VERSION}" = "" ]; then export VERSION=$(git -c versionsort.suffix=- ls-remote --sort='v:refname' --tags --refs ${REPO} | tail -n1 | sed 's/.*tags\///'); fi
is the code responsible to determine the version. If $VERSION is empty, it fetches every tag with git-ls-remote(1), get the last one with tail(1) and select the good part with sed(1). If $VERSION is not empty, it does nothing.
See https://stackoverflow.com/questions/10649814/get-last-git-tag-from-a-remote-repo-without-cloning for more information.