forked from SaraAlajmy/FinalProject-4-Coppilot-Sons-EndGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-and-push.sh
More file actions
executable file
·31 lines (24 loc) · 858 Bytes
/
build-and-push.sh
File metadata and controls
executable file
·31 lines (24 loc) · 858 Bytes
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
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# Define your Docker Hub username
DOCKERHUB_USERNAME="farahalfawzy"
IMAGE_TAG="latest"
echo "Building Maven projects..."
mvn clean install -DskipTests
mvn package -DskipTests
# Services and their directories
SERVICES=(
"chat-service:./chat-service"
"api-gateway-service:./gateway"
"group-chat-service:./groupChatService"
"notification-service:./notification-service"
"user-service:./userService"
)
for service_info in "${SERVICES[@]}"; do
IFS=':' read -r service_name service_dir <<< "$service_info"
echo "Building and pushing $service_name..."
docker build -t "${DOCKERHUB_USERNAME}/${service_name}:${IMAGE_TAG}" "${service_dir}"
docker push "${DOCKERHUB_USERNAME}/${service_name}:${IMAGE_TAG}"
done
echo "All images built and pushed successfully!"