-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
executable file
·67 lines (63 loc) · 1.75 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
#!/bin/bash
# Set up the help message
help_message="
(Note: Must be used from the root directory of this repository.)
Usage:
./run.sh COMMAND
Commands:
all run the build, deploy, and start commands in that order
build build the docker image for this repo
check check if files have been formatted
deploy deploy the bot commands to discord
fmt format the files using prettier
start start the bot server
help show this help message
"
# Process the command line arguments
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
help)
echo "$help_message"
exit
;;
all)
docker stop $(docker ps -aq) 2> /dev/null
docker rm $(docker ps -aq) 2> /dev/null
docker build -t ai-toolbox-bot .
docker run --rm ai-toolbox-bot run deploy
docker run --rm --pid=host ai-toolbox-bot run start
exit
;;
build)
docker build -t ai-toolbox-bot .
exit
;;
check)
docker run --rm -v $(pwd):/opt/app/ ai-toolbox-bot run check-fmt
exit
;;
deploy)
docker run --rm ai-toolbox-bot run deploy
exit
;;
fmt)
docker run --rm -v $(pwd):/opt/app/ ai-toolbox-bot run fmt
exit
;;
start)
docker run -it --rm --pid=host ai-toolbox-bot run start
exit
;;
watch)
fswatch -o ./ || xargs -n1 -I{} ./run.sh all
exit
;;
*)
echo "Unknown command: $key. Use the `help` command to see a list of available commands"
exit
;;
esac
shift
done