forked from district0x/district-voting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-push.sh
executable file
·80 lines (61 loc) · 1.28 KB
/
docker-push.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
#--- ARGS
BUILD_ENV=$1
#--- FUNCTIONS
function build {
{
NAME=$1
BUILD_ENV=$2
TAG=$(git log -1 --pretty=%h)
IMG=$NAME:$TAG
SERVICE=$(echo $NAME | cut -d "-" -f 2)
echo "============================================="
echo "["$BUILD_ENV"] ["$SERVICE"] Buidling: "$IMG""
echo "============================================="
lein less4j once
lein cljsbuild once "min"
docker build -t $IMG -f docker-builds/$SERVICE/Dockerfile .
case $BUILD_ENV in
# "qa")
# # qa images are tagged as `latest`
# docker tag $IMG $NAME:latest
# ;;
"prod")
# prod images are tagged as `release`
docker tag $IMG $NAME:release
;;
*)
echo "ERROR: don't know what to do with BUILD_ENV: "$BUILD_ENV""
exit 1
;;
esac
} || {
echo "EXCEPTION WHEN BUIDLING "$IMG""
exit 1
}
}
function push {
NAME=$1
echo "Pushing: " $NAME
docker push $NAME
}
function login {
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
}
function before {
lein deps
lein solc once
}
#--- EXECUTE
before
login
images=(
district0x/voting-ui
)
for i in "${images[@]}"; do
(
build $i $BUILD_ENV
push $i
)
done # END: i loop
exit $?