forked from trustwallet/trust-ray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trust
executable file
·59 lines (45 loc) · 963 Bytes
/
trust
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
#!/usr/bin/env bash
set -e
build() {
echo "Building..."
docker-compose pull
docker-compose build
_in_docker app npm install
_in_docker app npm run build
if [ "$?" -ne 0 ]; then
echo "Failed build"
else
echo "Build OK"
fi
}
run() {
docker-compose up -d --remove-orphans $*
}
stop() {
docker-compose stop $*
}
logs() {
docker-compose logs -f app
}
_in_docker() {
service="$1"
cmd="${@:2}"
docker-compose run --rm --no-deps $service bash -c "sleep 0.1; $cmd"
}
help() {
echo -e "build Build npm modules"
echo -e "run Run docker containers"
echo -e "stop Stop docker containers"
echo -e "logs App logs"
}
main() {
declare cmd="$1"
case "$cmd" in
run) shift; run "$@";;
stop) shift; stop "$@";;
build) shift; build;;
logs) shift; logs;;
*) help "$@";;
esac
}
main "$@"