-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·97 lines (83 loc) · 3.12 KB
/
deploy.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
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env bash
# __
# / _|
# __ _ _ _ _ __ ___ _ __ __ _ | |_ ___ ___ ___
# / _` | | | | '__/ _ \| '__/ _` | | _/ _ \/ __/ __|
# | (_| | |_| | | | (_) | | | (_| | | || (_) \__ \__ \
# \__,_|\__,_|_| \___/|_| \__,_| |_| \___/|___/___/
#
# Copyright (C) 2019 Aurora Free Open Source Software.
# Copyright (C) 2019 Luís Ferreira <[email protected]>
#
# This file is part of the Aurora Free Open Source Software. This
# organization promote free and open source software that you can
# redistribute and/or modify under the terms of the Boost Software License
# Version 1.0 available in the package root path as 'LICENSE' file. Please
# review the following information to ensure that the license requirements
# meet the opensource guidelines at opensource.org .
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# NOTE: All products, services or anything associated to trademarks and
# service marks used or referenced on this file are the property of their
# respective companies/owners or its subsidiaries. Other names and brands
# may be claimed as the property of others.
#
# For more info about intellectual property visit: aurorafoss.org or
# directly send an email to: contact (at) aurorafoss.org .
set -e
# Call getopt to validate the provided input.
options=$(getopt -o :p -- "$@")
[ $? -eq 0 ] || {
echo "Incorrect options provided"
exit 1
}
eval set -- "$options"
while true; do
case "$1" in
-p)
_DEPOLY_DOCKER_PUSH=1
;;
--)
shift
break
;;
esac
shift
done
trap "git clean -fdX; exit" SIGHUP SIGINT SIGTERM
for docker_file in $(find . -mindepth 2 -maxdepth 2 -type f -iname Dockerfile | sort); do
docker_folder=$(dirname $docker_file)
pushd "$docker_folder" > /dev/null
docker_name=$(basename $docker_folder)
docker_tag="aurorafossorg/$docker_name:$(cat .version 2> /dev/null || printf latest)"
if [ -f "./bootstrap.sh" ]; then
./bootstrap.sh
fi
docker build . -t "$docker_tag"
if [ "$_DEPOLY_DOCKER_PUSH" == "1" ];then
docker push "$docker_tag"
fi
for docker_subfile in $(find . -mindepth 2 -maxdepth 2 -type f -iname Dockerfile | sort); do
docker_subfolder="$(dirname $docker_subfile)"
pushd "$docker_subfolder" > /dev/null
docker_subname=$(basename $docker_subfolder)
docker_subtag="aurorafossorg/$docker_name-$docker_subname:$(cat .version 2> /dev/null || printf latest)"
if [ -f "./bootstrap.sh" ]; then
./bootstrap.sh
fi
docker build . -t "$docker_subtag"
if [ "$_DEPOLY_DOCKER_PUSH" == "1" ];then
docker push "$docker_subtag"
fi
popd > /dev/null
done
popd > /dev/null
done
git clean -fdX