-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.sh
executable file
·55 lines (42 loc) · 1.23 KB
/
dev.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
#!/usr/bin/env bash
# Current user
export CURRENT_UID=$(id -u):$(id -g)
# Parse input
backend=false
frontend=false
clean=false
while getopts 'bfc' flag; do
case "${flag}" in
b) backend=true ;;
f) frontend=true ;;
c) clean=true ;;
*) echo "Unexpected option ${flag}" ;;
esac
done
# Build the docker containers if clean flag is set
if [ "$clean" = true ]; then
rm vingo/.env || true
rm vinvoor/.env || true
docker compose -f docker-compose.yml build
fi
# Check for the required files
if [ ! -f vingo/.env ]; then
cp vingo/dev.env vingo/.env
fi
if [ ! -f vinvoor/.env ]; then
cp vinvoor/dev.env vinvoor/.env
fi
# Start the docker containers
docker compose -f docker-compose.yml up -d
echo "-------------------------------------"
echo "Following logs..."
echo "Press CTRL + C to stop all containers"
echo "-------------------------------------"
if [ "$backend" = true ] && [ "$frontend" = false ]; then
docker compose -f docker-compose.yml logs -f zess-backend
elif [ "$backend" = false ] && [ "$frontend" = true ]; then
docker compose -f docker-compose.yml logs -f zess-frontend
else
docker compose -f docker-compose.yml logs -f zess-backend zess-frontend
fi
docker compose -f docker-compose.yml down