2018-07-31 19:14:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-07-12 12:55:47 +00:00
|
|
|
set -e
|
|
|
|
|
2018-07-31 19:14:59 +00:00
|
|
|
tag=$1
|
|
|
|
|
|
|
|
if [ -z $tag ]; then
|
|
|
|
echo "please provide a tag arg"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
major=$(echo $tag | awk -F. '{print $1}')
|
|
|
|
minor=$(echo $tag | awk -F. '{print $2}')
|
|
|
|
# patch=$(echo $tag | awk -F. '{print $3}')
|
|
|
|
|
2019-10-15 07:45:50 +00:00
|
|
|
tf_ver="0.12.10"
|
2018-07-31 19:14:59 +00:00
|
|
|
|
2018-10-11 19:22:15 +00:00
|
|
|
echo "Confirm building images for:"
|
|
|
|
echo " MAJOR: ${major}"
|
|
|
|
echo " MINOR: ${minor}"
|
|
|
|
echo " TF_VERSION: ${tf_ver}"
|
|
|
|
|
|
|
|
read -p "Proceed? [Y/N] " ans
|
|
|
|
|
|
|
|
if [[ "$ans" != "Y" && "$ans" != "y" ]]; then
|
|
|
|
echo "Cancelling"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-07-12 12:55:47 +00:00
|
|
|
set -x
|
2019-08-05 15:46:47 +00:00
|
|
|
docker build -t jmccann/drone-terraform:latest --build-arg terraform_version=${tf_ver} .
|
2018-07-31 19:14:59 +00:00
|
|
|
|
|
|
|
docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major}
|
|
|
|
docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major}.${minor}
|
|
|
|
docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major}.${minor}-${tf_ver}
|
|
|
|
|
|
|
|
docker push jmccann/drone-terraform:latest
|
|
|
|
docker push jmccann/drone-terraform:${major}
|
|
|
|
docker push jmccann/drone-terraform:${major}.${minor}
|
|
|
|
docker push jmccann/drone-terraform:${major}.${minor}-${tf_ver}
|
2018-10-11 19:22:15 +00:00
|
|
|
set +x
|