-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_functions.sh
43 lines (36 loc) · 1 KB
/
run_functions.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
#!/usr/bin/env bash
DIST_PATH=dist
# Execute preparation scripts for specific component.
prepare() {
local component="$1"
if [ -f ${DIST_PATH}/${component}/prepare_env.sh ]; then
echo "Executing preparation script."
cd ${DIST_PATH}/${component}
source prepare_env.sh || exit 1
cd ../..
fi
}
# Execute tear down scripts for specific component.
teardown() {
local component="$1"
if [ -f ${DIST_PATH}/${component}/teardown_env.sh ]; then
echo "Executing teardown script."
cd ${DIST_PATH}/${component}/
bash teardown_env.sh
cd ../..
fi
}
# Merge all component docker compose files to start them.
merge_docker_files() {
local compose_files=""
for component in "$@"; do
compose_files="${compose_files} -f $DIST_PATH/$component/docker-compose.yml"
done
echo ${compose_files}
}
export_image() {
local component="$1"
local folder="$2"
echo "Exporting image for component $component"
docker save kalki/${component}:latest | gzip > ${folder}/${component}.tar.gz
}