This repository was archived by the owner on Sep 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·63 lines (52 loc) · 1.64 KB
/
run.sh
File metadata and controls
executable file
·63 lines (52 loc) · 1.64 KB
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
#!/usr/bin/bash
if [ $# -gt 0 ]; then
if [[ $@ = *"-dev"* ]]; then
sed -i -e 's/@database/@localhost/g' .env
echo " ports: # temp dev ports" >>docker-compose.yml
echo " - '127.0.0.1:3306:3306' # temp dev ports" >>docker-compose.yml
docker-compose up -d db
docker-compose stop node
npm run db
sed -i -e "s/ ports: # temp dev ports//g" docker-compose.yml
sed -i -e "s/ - '127.0.0.1:3306:3306' # temp dev ports//g" docker-compose.yml
sed -i -Ez '$ s/\n+$//' docker-compose.yml
echo "" >>docker-compose.yml
npm run dev
exit 1
fi
if [[ $@ = *"-l"* ]]; then
docker-compose logs -f node
exit 1
fi
if [[ $@ = *"-g"* ]]; then
if [ "$(git pull)" = "Already up to date." ]; then
echo "Up-to-date"
echo "----------"
else
echo "Need to Update"
echo "--------------"
sed -i -e 's/@localhost/@database/g' .env
docker-compose up --build -d
fi
fi
if [[ $@ = *"-f"* ]]; then
echo "Force update"
echo "------------"
sed -i -e 's/@localhost/@database/g' .env
docker-compose up --build -d
read -p "View log of node container (y/n)?" yn
case $yn in
[Yy]*)
docker-compose logs -f node
exit 1
;;
*) exit 1 ;;
esac
fi
else
echo "-dev build db container; npm run dev"
echo "-f force recreate docker containers"
echo "-g git pull; build containers if needed"
echo "-l view logs of node container"
exit
fi