2019-09-28 20:49:01 +00:00
|
|
|
#!/bin/sh
|
2019-09-28 23:28:04 +00:00
|
|
|
|
2019-10-04 22:58:05 +00:00
|
|
|
CLOSEST_VER=$(git describe --tags --abbrev=0 ${SOURCE_COMMIT})
|
|
|
|
if git describe --exact-match --abbrev=0 ${SOURCE_COMMIT} 2> /dev/null; then
|
2019-09-28 23:28:04 +00:00
|
|
|
BUILD_INFO="v${CLOSEST_VER}"
|
|
|
|
else
|
2019-10-04 22:58:05 +00:00
|
|
|
BUILD_INFO="v${CLOSEST_VER}-edge-$(git rev-parse --short ${SOURCE_COMMIT})"
|
2019-09-28 23:28:04 +00:00
|
|
|
fi
|
|
|
|
|
2019-10-04 22:58:05 +00:00
|
|
|
echo "Using BUILD_INFO=${BUILD_INFO}"
|
|
|
|
docker build \
|
|
|
|
--build-arg BUILD_INFO \
|
|
|
|
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
|
|
|
--build-arg SOURCE_COMMIT \
|
|
|
|
--build-arg DOCKER_REPO \
|
|
|
|
-f $DOCKERFILE_PATH -t $IMAGE_NAME .
|