DamageAssessment_Backend/Scripts/build_and_push_services2acr.sh
2023-10-17 22:40:34 -04:00

41 lines
1.3 KiB
Bash

#!/bin/bash
# Determine the current directory (where the script is located)
script_directory="$( cd "$(dirname "$0")" ; pwd -P )"
# Navigate to the root of the repository
repository_root="$script_directory/.."
# Specify the relative path to the docker-compose.yml
relative_path="DamageAssesmentApi/docker-compose.yml"
# Combine the repository root directory with the relative path to get the full path to docker-compose.yml
composeFile="$repository_root/$relative_path"
# List of services to build, tag, and push
services=(
"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
docker-compose -f "$composeFile" build #"$service"
# Tag the image for ACR
docker tag "$service" "dadeschoolscontainerregistry.azurecr.io/$service"
# Push the image to ACR
docker push "dadeschoolscontainerregistry.azurecr.io/$service"
done