-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-build.sh
43 lines (36 loc) · 926 Bytes
/
docker-build.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
#!/bin/bash
# List of your services directories
services=(
"apigetway"
"authentication"
"cart"
"catalog"
"inventory"
"order"
"payment"
"servicediscovery"
# Add any additional services here
)
# Loop through each service
for service in "${services[@]}"; do
echo "Building Docker image for service: $service"
# Check if the directory exists
if [ -d "$service" ]; then
# Navigate into the service directory
cd $service || exit
# Run Maven command to build the Docker image
mvn spring-boot:build-image
# Check if the build command was successful
if [ $? -eq 0 ]; then
echo "Successfully built Docker image for $service"
else
echo "Failed to build Docker image for $service"
exit 1
fi
# Go back to the root directory
cd ..
else
echo "Directory for $service does not exist. Skipping..."
fi
done
echo "All services have been processed."