From d219faa14709cca9c36d6d254cc89fd682f70b8d Mon Sep 17 00:00:00 2001 From: Santhosh S <913341@dadeschools.net> Date: Tue, 17 Oct 2023 22:40:34 -0400 Subject: [PATCH] Updated with folder path --- Scripts/build_and_push_services2acr.sh | 32 ++++++++------------------ 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/Scripts/build_and_push_services2acr.sh b/Scripts/build_and_push_services2acr.sh index a4fd039..dd0250b 100644 --- a/Scripts/build_and_push_services2acr.sh +++ b/Scripts/build_and_push_services2acr.sh @@ -1,22 +1,16 @@ #!/bin/bash -# Get the current working directory -current_directory="$(pwd)" -echo "Current directory: $current_directory" +# Determine the current directory (where the script is located) +script_directory="$( cd "$(dirname "$0")" ; pwd -P )" -# Navigate one folder up -#cd .. - -# Get and display the new working directory -current_directory="$(pwd)" -echo "New directory: $current_directory" +# Navigate to the root of the repository +repository_root="$script_directory/.." # Specify the relative path to the docker-compose.yml -relative_path="DamageAssesmentApi" +relative_path="DamageAssesmentApi/docker-compose.yml" -# Combine the current directory with the relative path to get the full path to docker-compose.yml -#composeFile="$current_directory/DamageAssesmentApi/docker-compose.yml" -composeFile="../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=( @@ -36,19 +30,11 @@ docker login dadeschoolscontainerregistry.azurecr.io -u dadeSchoolsContainerRegi # Loop through the services and build, tag, and push for service in "${services[@]}"; do # Build the service - docker-compose -f "$composeFile" build #"$service" + docker-compose -f "$composeFile" build #"$service" # Tag the image for ACR - docker tag $service "dadeschoolscontainerregistry.azurecr.io/$service" + docker tag "$service" "dadeschoolscontainerregistry.azurecr.io/$service" # Push the image to ACR docker push "dadeschoolscontainerregistry.azurecr.io/$service" 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 ""