mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
Docker Hub makes a shallow clone of the git repo, so we don't have tags anyway, we end up with commit-master (e.g. 289f849-master), put the branch first so it's more human readable (master-289f849)
20 lines
782 B
Bash
Executable File
20 lines
782 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# hub.docker.com build hook to set additional build time args
|
|
# https://docs.docker.com/docker-cloud/builds/advanced/
|
|
|
|
if [[ $DOCKER_TAG == v* ]]; then
|
|
# DOCKER_TAG is the tag docker will use for our image
|
|
# images on docker hub are only generated from master branch and tags
|
|
# release tags in git follow vX.Y.Z format, so if DOCKER_TAG starts with 'v'
|
|
# it's only a release tag, let's use that as the version
|
|
VERSION=${DOCKER_TAG}
|
|
else
|
|
# for everything else generate version from branch name and git tag/commit
|
|
# it would be best to use SOURCE_COMMIT here, but it doesn't work
|
|
# see https://github.com/docker/hub-feedback/issues/600
|
|
VERSION=${SOURCE_BRANCH}-$(git describe --always)
|
|
fi
|
|
|
|
docker build --build-arg VERSION=${VERSION} -t ${IMAGE_NAME} .
|