-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice
executable file
·58 lines (47 loc) · 1.4 KB
/
service
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
#!/bin/bash
echo -e '\033[36m
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""\___/ ===
\033[36m ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/\033[0m'
tput sgr0
USAGE='
service \033[31mstart\033[0m - start the environment
service \033[31mstop\033[0m - stop the environment
service \033[31mkick\033[0m - restarts the environment
service \033[31mlogs\033[0m - watch the Docker logs
service \033[31mdev\033[0m - run locally without docker
service \033[31mbuild\033[0m - build container
'
function build() {
docker build -t finger-service -f Dockerfile .
}
function start() {
build
docker run --restart always -d -p79:79 -p7979:7979 --name finger-service finger-service
echo -e 'Your containers are starting in the background. Use \033[31mservice log\033[0m to look at the logs.'
}
function stop() {
echo -e "stopping"
docker rm -f finger-service
}
function kick() {
stop && start
}
function logs() {
docker logs --follow finger-service
}
function dev() {
stop
npx nodemon --watch 'src/**/*.*' --watch 'public/**/*.*' --exec 'npm run service'
}
function usage() {
echo -e "$USAGE"
tput sgr0
exit 1
}
if ! type "$1" >/dev/null 2>&1; then usage; else $1; fi