Add current git tag information as env variable in Docker Hub automated builds

During an automated build on Docker Hub, it would be most useful to know which is the current tag or branch name being built, in order to have that information available from within the container. In particular, we are looking for writing a VERSION file during the build process, with the name of the current tag, which will then be displayed by the application.

Would it be feasible for docker hub to provide certain env variables during the build process with this information, similar to the TRAVIS_TAG or TRAVIS_BRANCH vars from Travis? Thank you!