-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.sh
More file actions
executable file
·37 lines (29 loc) · 1.07 KB
/
docker-compose.sh
File metadata and controls
executable file
·37 lines (29 loc) · 1.07 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
#!/bin/sh
Green='\033[0;32m'
Yellow='\033[0;33m'
NC='\033[0m' # No Color
servicesName=(
'service-discovery'
'gateway'
'sales-catalog'
'basket-service'
)
for name in "${servicesName[@]}"
do
DOCKER_IMAGE_ID=$(docker images -aq docker-local-setup-${name})
if [[ ! -z "${DOCKER_IMAGE_ID}" ]]; then
LIVE_CONTAINER_ID=$(docker ps -a | grep `docker images | grep ${DOCKER_IMAGE_ID} | awk '{print $1":"$2}'` | awk '{print $1}')
if [[ ! -z "${LIVE_CONTAINER_ID}" ]]; then
printf "${Green}Removing existing container for ${Yellow}${name}${Green} with image id: ${Yellow}${DOCKER_IMAGE_ID}${NC}\n"
docker rm -f "${LIVE_CONTAINER_ID}"
fi
printf "${Green}Removing existing docker image for ${Yellow}${name}${Green} with id: ${Yellow}${DOCKER_IMAGE_ID}${NC}\n"
docker rmi "${DOCKER_IMAGE_ID}"
fi
echo "${Green}Building ${Yellow}${name}${NC}"
cd "${name}"
./gradlew clean build -x :app:generateGitProperties
cd ..
done
echo "${Yellow}Starting Docker Compose${NC}"
docker-compose up -d --build