-
Notifications
You must be signed in to change notification settings - Fork 93
/
build-docker.sh
executable file
·40 lines (29 loc) · 990 Bytes
/
build-docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
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}')
tf_ver="1.0.2"
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
set -x
docker build -t jmccann/drone-terraform:latest --build-arg terraform_version=${tf_ver} .
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}
set +x