Files
Checkmate/Docker/dev/build_images.sh
T

26 lines
741 B
Bash
Raw Normal View History

#!/bin/bash
# Change directory to root Server directory for correct Docker Context
2024-10-19 15:18:00 +05:30
cd "$(dirname "$0")"
2024-10-01 15:52:46 +08:00
cd ../..
2024-10-19 14:28:58 +05:30
# Define an array of services and their Dockerfiles
declare -A services=(
["uptime_client"]="./Docker/dev/client.Dockerfile"
["uptime_database_mongo"]="./Docker/dev/mongoDB.Dockerfile"
["uptime_redis"]="./Docker/dev/redis.Dockerfile"
["uptime_server"]="./Docker/dev/server.Dockerfile"
)
# Loop through each service and build the corresponding image
for service in "${!services[@]}"; do
docker build -f "${services[$service]}" -t "$service" .
2024-10-19 14:33:56 +05:30
## Check if the build succeeded
2024-10-19 14:28:58 +05:30
if [ $? -ne 0 ]; then
echo "Error building $service image. Exiting..."
exit 1
fi
done
echo "All images built successfully"