modified push acr script

This commit is contained in:
Santhosh S 2023-10-17 15:14:41 -04:00
parent acb5067ce5
commit fa68071d64

View File

@ -2,23 +2,31 @@
# Get the current working directory # Get the current working directory
current_directory="$(pwd)" current_directory="$(pwd)"
echo "Current directory: $current_directory"
# Navigate one folder up
cd ..
# Get and display the new working directory
current_directory="$(pwd)"
echo "New directory: $current_directory"
# Specify the relative path to the docker-compose.yml # Specify the relative path to the docker-compose.yml
relative_path="Backend-API-Services/DamageAssesmentApi" relative_path="DamageAssesmentApi"
# Combine the current directory with the relative path to get the full path to docker-compose.yml # Combine the current directory with the relative path to get the full path to docker-compose.yml
composeFile="$current_directory/$relative_path/docker-compose.yml" composeFile="$current_directory/$relative_path/docker-compose.yml"
# List of services to build, tag, and push # List of services to build, tag, and push
services=( services=(
"damageassesment.api.answers" "damageassesmentapianswers"
"damageassesment.api.attachments" "damageassesmentapiattachments"
"damageassesment.api.employees" "damageassesmentapiemployees"
"damageassesment.api.locations" "damageassesmentapilocations"
"damageassesment.api.questions" "damageassesmentapiquestions"
"damageassesment.api.responses" "damageassesmentapisurveys"
"damageassesment.api.surveys" "damageassesmentapidoculinks"
"damageassesment.api.doculinks" "damageassesmentapiresponses"
) )
# Log in to ACR (replace ACR_USERNAME and ACR_PASSWORD) # Log in to ACR (replace ACR_USERNAME and ACR_PASSWORD)
@ -27,7 +35,7 @@ docker login dadeschoolscontainerregistry.azurecr.io -u dadeSchoolsContainerRegi
# Loop through the services and build, tag, and push # Loop through the services and build, tag, and push
for service in "${services[@]}"; do for service in "${services[@]}"; do
# Build the service # Build the service
docker-compose -f "$composeFile" build "$service" docker-compose -f "$composeFile" build # "$service"
# Tag the image for ACR # Tag the image for ACR
docker tag "$service" "dadeschoolscontainerregistry.azurecr.io/$service" docker tag "$service" "dadeschoolscontainerregistry.azurecr.io/$service"
@ -35,3 +43,11 @@ for service in "${services[@]}"; do
# Push the image to ACR # Push the image to ACR
docker push "dadeschoolscontainerregistry.azurecr.io/$service" docker push "dadeschoolscontainerregistry.azurecr.io/$service"
done done
# Get and display the current working directory
current_directory="$(pwd)"
echo "Current directory: $current_directory"
# Wait for a keypress
echo "Press any key to continue..."
read -n 1 -s -r -p ""