-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
80 lines (69 loc) · 1.5 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
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
DOCKER_COMPOSE="docker-compose"
SRC_DIR="src"
MAIN_FILE="index.js"
help() {
echo "Available targets:"
echo "Run bot with Docker Compose:"
echo " ./run.sh start - Build and start the bot with Docker Compose"
echo " ./run.sh start-noll - Build and start the bot without Lavalink with Docker Compose"
echo " ./run.sh restart - Restart the bot using Docker Compose"
echo " ./run.sh stop - Stop the Docker container (if running)"
echo " ./run.sh clean - Remove Docker container and image"
echo "Run the bot without Docker:"
echo " ./run.sh start-local - Install dependencies and run the bot locally"
}
build() {
$DOCKER_COMPOSE build
}
start() {
build
$DOCKER_COMPOSE up -d
}
start-noll() {
build
$DOCKER_COMPOSE up -d --no-deps musicbot
}
restart() {
$DOCKER_COMPOSE restart
}
stop() {
$DOCKER_COMPOSE down
}
clean() {
stop
$DOCKER_COMPOSE down --rmi all
}
start-local() {
echo "Running bot locally..."
(cd $SRC_DIR && npm install)
(cd $SRC_DIR && node $MAIN_FILE)
}
case "$1" in
help)
help
;;
start)
start
;;
start-noll)
start-noll
;;
restart)
restart
;;
stop)
stop
;;
clean)
clean
;;
start-local)
start-local
;;
*)
echo "Invalid command. See available targets with './run.sh help'"
exit 1
;;
esac
exit 0