-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-project.sh
executable file
·48 lines (40 loc) · 1.08 KB
/
run-project.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
#!/bin/bash
# shellcheck disable=SC2034
SUBDIR="./build/libs"
IMAGE_NAME="notification-service-notificiationapp"
CONTAINER_APP="shapeup-notification-app"
DEFAULT_SLEEP_TIME=2
echo "Iniciando script..."
echo ""
./gradlew clean build
sleep $DEFAULT_SLEEP_TIME
clear
echo "Verificando a existência de $SUBDIR..."
if [ -d "$SUBDIR" ]; then
if docker-compose ps | grep -q "$CONTAINER_APP"; then
echo "Encerrando o container '$CONTAINER_APP'..."
echo ""
docker-compose down
sleep $DEFAULT_SLEEP_TIME
clear
else
echo "O container '$CONTAINER_APP' não está em execução"
fi
if docker images | grep -q "$IMAGE_NAME"; then
echo "A imagem '$IMAGE_NAME' já existe. Removendo..."
echo ""
docker rmi "$IMAGE_NAME"
sleep $DEFAULT_SLEEP_TIME
clear
else
echo "A imagem '$IMAGE_NAME' não existe."
fi
docker compose up -d
sleep $DEFAULT_SLEEP_TIME
clear
else
echo "O subdiretório '$SUBDIR' não existe neste diretório."
fi
echo "Script concluído."
sleep $DEFAULT_SLEEP_TIME
clear