-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
61 lines (45 loc) · 1.18 KB
/
run
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
#!/bin/bash
# exit if any command fails
set -e
_main() {
if [[ $# -eq 0 || "$1" == "help" ]]; then
# No args provided, print help
_displayUsage
exit
elif [[ "$(type -t $1)" == "function" ]]; then
# First arg is a function in this script
# execute command as provided
"$@"
else
# First arg is not a function in this script
# print help
_displayUsage
fi
}
_displayUsage() {
echo -e "
Commands:
help (or invalid args)
Prints these instructions
buildApp
Builds the application's docker container and tags it as rental_property_scraper:latest.
runApp
Runs the application's docker container.
buildAndRunApp
Builds and then runs the application's docker container.
"
}
buildApp() {
echo "Building the rental_property_scraper docker container"
docker build -t rental_property_scraper:latest -f Dockerfile .
}
runApp() {
echo "Running the rental_property_scraper docker container"
docker run rental_property_scraper:latest
}
buildAndRunApp() {
echo "Attempting to build and then run the rental_property_scraper docker container"
buildApp
runApp
}
main "$@"