From 7c40bc4e4f8e059132dd2f511c7f785b1edd41b6 Mon Sep 17 00:00:00 2001 From: vimal-knoldus Date: Sun, 24 Sep 2023 08:30:06 +0530 Subject: [PATCH] Added ACR to pipeline --- az-svc-deployment.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/az-svc-deployment.sh b/az-svc-deployment.sh index 0c204c05..d5c01dc1 100644 --- a/az-svc-deployment.sh +++ b/az-svc-deployment.sh @@ -4,15 +4,18 @@ AKS_CLUSTER="ntdemocluster" SERVICE_NAME="admin-service" DEPLOYMENT_NAME="admin-service" RESOURCE_GROUP_NAME="az-nashtech-resource-group" +ACR_NAME = "ntdemocontainerregistry" +#.azurecr.io" sudo az aks install-cli +sudo az acr login --name $ACR_NAME echo "---------build and deploy $SERVICE_NAME-----------" cd "$SERVICE_NAME" || exit mvn clean install echo "---------packaging done, start docker build-----------" -sudo docker build -f Dockerfile --tag gcr.io/"$SERVICE_NAME":"$GITHUB_SHA" . +sudo docker build -f Dockerfile --tag ntdemocontainerregistry.azurecr.io/"$SERVICE_NAME":"$GITHUB_SHA" . echo "--------docker build done, docker push---------------" -sudo docker push gcr.io/"$SERVICE_NAME":"$GITHUB_SHA" +sudo docker push ntdemocontainerregistry.azurecr.io/"$SERVICE_NAME":"$GITHUB_SHA" echo "--------pushed docker image, deploy to aks cluster--------------------------" sudo az aks get-credentials --resource-group "$RESOURCE_GROUP_NAME" --name "$AKS_CLUSTER" @@ -21,7 +24,7 @@ curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/downl chmod u+x ./kustomize # set docker image for kustomize -./kustomize edit set image gcr.io/IMAGE:TAG=gcr.io/"$SERVICE_NAME":"$GITHUB_SHA" +./kustomize edit set image ntdemocontainerregistry.azurecr.io/IMAGE:TAG=ntdemocontainerregistry.azurecr.io/"$SERVICE_NAME":"$GITHUB_SHA" # deploy through kubectl ./kustomize build . | kubectl apply -f - kubectl rollout status deployment/"$DEPLOYMENT_NAME"