DamageAssessment_Backend/Scripts/build_and_push_services2acr.sh

40 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/bash
2023-10-17 21:40:34 -05:00
# Determine the current directory (where the script is located)
script_directory="$( cd "$(dirname "$0")" ; pwd -P )"
2023-10-17 14:14:41 -05:00
2023-10-17 22:04:28 -05:00
# Use the 'find' command to locate the 'docker-compose.yml' file within the repository directory
composeFile=$(find "$script_directory/.." -name "docker-compose.yml" -type f | head -n 1)
2023-10-17 11:09:42 -05:00
2023-10-17 22:04:28 -05:00
if [ -z "$composeFile" ]; then
echo "docker-compose.yml not found."
exit 1
fi
# List of services to build, tag, and push
services=(
2023-10-17 14:14:41 -05:00
"damageassesmentapianswers"
"damageassesmentapiattachments"
"damageassesmentapiemployees"
"damageassesmentapilocations"
"damageassesmentapiquestions"
"damageassesmentapisurveys"
"damageassesmentapidoculinks"
"damageassesmentapiresponses"
)
# Log in to ACR (replace ACR_USERNAME and ACR_PASSWORD)
docker login dadeschoolscontainerregistry.azurecr.io -u dadeSchoolsContainerRegistry -p k1f8hE0O5hj3tYCCR/5stNrkw5BZoTmAqid/hvaVo8+ACRDc2Arn
# Loop through the services and build, tag, and push
for service in "${services[@]}"; do
# Build the service
2023-10-17 22:04:28 -05:00
docker-compose -f "$composeFile" build "$service"
# Tag the image for ACR
2023-10-17 21:40:34 -05:00
docker tag "$service" "dadeschoolscontainerregistry.azurecr.io/$service"
# Push the image to ACR
docker push "dadeschoolscontainerregistry.azurecr.io/$service"
done