DamageAssessment_Backend/Scripts/build_and_push_services2acr.sh

55 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/bash
2023-10-17 11:09:42 -05:00
# Get the current working directory
current_directory="$(pwd)"
2023-10-17 14:14:41 -05:00
echo "Current directory: $current_directory"
# Navigate one folder up
2023-10-17 21:18:56 -05:00
#cd ..
2023-10-17 14:14:41 -05:00
# Get and display the new working directory
current_directory="$(pwd)"
echo "New directory: $current_directory"
2023-10-17 11:09:42 -05:00
# Specify the relative path to the docker-compose.yml
2023-10-17 14:14:41 -05:00
relative_path="DamageAssesmentApi"
2023-10-17 11:09:42 -05:00
# Combine the current directory with the relative path to get the full path to docker-compose.yml
2023-10-17 21:10:31 -05:00
#composeFile="$current_directory/DamageAssesmentApi/docker-compose.yml"
2023-10-17 21:18:56 -05:00
composeFile="../DamageAssesmentApi/docker-compose.yml"
# 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 21:07:15 -05:00
docker-compose -f "$composeFile" build #"$service"
# Tag the image for ACR
2023-10-17 14:27:44 -05:00
docker tag $service "dadeschoolscontainerregistry.azurecr.io/$service"
# Push the image to ACR
docker push "dadeschoolscontainerregistry.azurecr.io/$service"
done
2023-10-17 14:14:41 -05:00
# Get and display the current working directory
current_directory="$(pwd)"
echo "Current directory: $current_directory"
# Wait for a keypress
2023-10-17 14:27:44 -05:00
#echo "Press any key to continue..."
2023-10-17 21:18:56 -05:00
read -n 1 -s -r -p ""