-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·69 lines (59 loc) · 1.17 KB
/
run.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
#!/bin/bash
usage() {
echo "Usage: -b : Run project for first time or changes made
-i : If need to init airflow
-u : Run project if already ran once and no changes
-d : Down the project"
}
export_env() {
set -a
source .env
set +a
}
init_airflow(){
docker compose up airflow-init
}
copy_func() {
cp ./func/functions.py ./api/
mkdir ./airflow/func/
cp ./func/functions.py ./airflow/func/
}
delete_copy_func() {
rm -f ./api/functions.py
}
docker_up_and_build() {
docker-compose up -d --build
}
docker_up() {
docker-compose up -d
}
docker_down() {
docker-compose down --volumes --remove-orphans
}
export_env
while getopts ":biudh" option; do
case $option in
b) # Run project for first time or changes made
copy_func
docker_up_and_build
delete_copy_func
exit
;;
i) # Init airflow
init_airflow
exit
;;
u) # Run project if already ran once and no changes
docker_up
exit
;;
d) # Down the project
docker_down
exit
;;
h) # Documentation help
usage
exit
;;
esac
done