1
0
Fork 0
js-utils/scripts/docker-build.sh

18 lines
395 B
Bash
Raw Normal View History

2019-09-21 10:32:44 +00:00
#! /bin/bash
IMAGE_PUSH="${1:---skip}"
2019-09-21 10:32:44 +00:00
IMAGE_NAME="${CI_PROJECT_PATH}"
IMAGE_TAG="$(echo "${CI_COMMIT_TAG:-${CI_COMMIT_REF_SLUG}}" | sed -r 's/[^-_a-zA-Z0-9]/-/g')"
IMAGE_FULL="${IMAGE_NAME}:${IMAGE_TAG}"
2019-09-21 10:32:44 +00:00
echo "Building image: ${IMAGE_FULL}"
2019-09-23 13:13:44 +00:00
docker build -t "${IMAGE_FULL}" .
if [[ "${IMAGE_PUSH}" == "--push" ]];
then
2019-09-21 10:32:44 +00:00
echo "Pushing image: ${IMAGE_FULL}"
2019-09-23 13:13:44 +00:00
docker push "${IMAGE_FULL}"
fi