-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-dev.sh
More file actions
43 lines (34 loc) · 1.15 KB
/
build-dev.sh
File metadata and controls
43 lines (34 loc) · 1.15 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
#!/bin/bash
clear
#Check if docker is running
if ! docker info &>/dev/null; then
echo "Docker is not running. Please start Docker and try again."
exit 1
fi
action="$1"
# Check if the first parameter to this script is "build" else default to up
if [ "$action" == "fresh" ]; then
echo "Compose fresh BUILD and UP..."
docker-compose -f docker-compose-dev.yml build --no-cache
docker-compose -f docker-compose-dev.yml down --remove-orphans
docker-compose -f docker-compose-dev.yml up -d
else
echo "Compose UP..."
# docker-compose -f docker-compose-dev.yml down
docker-compose -f docker-compose-dev.yml up -d
fi
# Check if all services are up and running
echo "Checking if all services are up and running..."
services=("wordpress" "nginx" "db" )
for service in "${services[@]}"
do
state=$(docker inspect --format '{{.State.Status}}' $service)
if [ "$state" == "running" ]; then
echo " ✔ $service is up and running"
elif [ "$state" == "restarting" ]; then
echo " X $service is restarting"
else
echo " X $service is not running"
fi
done
# echo "All Services are now up and running √"