-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
87 lines (66 loc) · 1.73 KB
/
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
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
81
82
83
84
85
86
87
#/bin/bash
TAG_FASTRTPS='v2.0.1'
task () {
echo ""
echo "#############################################"
echo " $1"
echo "#############################################"
echo ""
}
task "Build target: fastrtps:${TAG_FASTRTPS}-dev"
docker build \
--rm \
--target dev \
-t fastrtps:${TAG_FASTRTPS}-dev \
-f Dockerfile \
.
if [ "$?" -ne 0 ];then
>&2 echo "Build of target failed: fastrtps:${TAG_FASTRTPS}-dev"
exit 1
fi
task "Build target: fastrtps:${TAG_FASTRTPS}"
docker build \
--rm \
--target runtime \
-t fastrtps:${TAG_FASTRTPS} \
-f Dockerfile \
.
if [ "$?" -ne 0 ];then
>&2 echo "Build of target failed: fastrtps:${TAG_FASTRTPS}"
exit 2
fi
task "Build target: fastrtps:${TAG_FASTRTPS}-example"
docker build \
--rm \
--target example \
-t fastrtps:${TAG_FASTRTPS}-example \
-f Dockerfile \
.
if [ "$?" -ne 0 ];then
>&2 echo "Build of target failed: fastrtps:${TAG_FASTRTPS}-example"
exit 3
fi
task "generate Dockerfiles for docker hub"
python3 gen_dockerfiles_for_docker_hub.py
if [ "$?" -ne 0 ];then
>&2 echo "Failed to generate Dockerfiles for docker hub"
exit 4
fi
echo "Image geneneration succesfully."
read -p "Do you want to tag and push changes to git [yes/NO]: " choice
choice=${choice:-NO}
choice=${choice,,}
if [ "${choice}" == "yes" ]; then
echo "> git add Dockerfile dockerhub/* README.md gen_dockerfiles_for_docker_hub.py"
git add Dockerfile dockerhub/* README.md gen_dockerfiles_for_docker_hub.py
echo '> git commit -m "upgrade to FastRTPS ${TAG_FASTRTPS}"'
git commit -m "upgrade to FastRTPS ${TAG_FASTRTPS}"
echo "> git tag ${TAG_FASTRTPS} -f"
git tag ${TAG_FASTRTPS} -f
echo "> git tag latest -f"
git tag latest -f
echo "> git push"
git push
echo "> git push --tags -f"
git push --tags -f
fi