-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
30 lines (26 loc) · 630 Bytes
/
build.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
#!/bin/bash
version="latest"
if [ -n "$1" ]; then
version=$1
fi
name="cryptoeyes"
repo="hieutrtr"
echo "Creating Docker container"
result=`docker build --no-cache -t $name:$version . | tail -n1`
echo $result
if [[ ${result} != *"Successfully"* ]]; then
echo "Build failed"
echo $result
exit
fi
id=`echo $result | cut -d ' ' -f3`
docker login --username "hieutrtr" --password "1547896sS"
echo "Tagging and pushing to Docker hub"
docker tag $id $repo/$name:$version
result=`docker push $repo/$name:$version`
if [[ ${result} != *"$version"* ]]; then
echo "Push failed"
echo $result
exit
fi
echo $result