Update production build script
This commit is contained in:
1 parent
5dda7cdde7
commit
dd235f0d81
1 file changed
+19
-17
+19
-17
@@ -1,24 +1,26 @@
|
|||||||
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Change directory to root directory for correct Docker Context
|
# Change directory to root directory for correct Docker Context
|
||||||
|
cd "$(dirname "$0")"
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
#Client
|
# Define an array of services and their Dockerfiles
|
||||||
client="./Docker/prod/client.Dockerfile"
|
declare -A services=(
|
||||||
|
["uptime_client"]="./Docker/prod/client.Dockerfile"
|
||||||
|
["uptime_database_mongo"]="./Docker/prod/mongoDB.Dockerfile"
|
||||||
|
["uptime_redis"]="./Docker/prod/redis.Dockerfile"
|
||||||
|
["uptime_server"]="./Docker/prod/server.Dockerfile"
|
||||||
|
)
|
||||||
|
|
||||||
# MongoDB
|
# Loop through each service and build the corresponding image
|
||||||
mongoDB="./Docker/prod/mongoDB.Dockerfile"
|
for service in "${!services[@]}"; do
|
||||||
|
docker build -f "${services[$service]}" -t "$service" .
|
||||||
|
|
||||||
|
# Check if the build succeeded
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error building $service image. Exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Redis
|
echo "All images built successfully"
|
||||||
redis="./Docker/prod/redis.Dockerfile"
|
|
||||||
|
|
||||||
# Server
|
|
||||||
server="./Docker/prod/server.Dockerfile"
|
|
||||||
|
|
||||||
docker build -f $client -t uptime_client .
|
|
||||||
docker build -f $mongoDB -t uptime_database_mongo .
|
|
||||||
docker build -f $redis -t uptime_redis .
|
|
||||||
docker build -f $server -t uptime_server .
|
|
||||||
|
|
||||||
echo "All images built"
|
|
||||||
Reference in new issue
Block a user