Skip to content

Commit

Permalink
Added ACR to pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
vimal-knoldus committed Sep 24, 2023
1 parent ccfb8d6 commit 7c40bc4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions az-svc-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 7c40bc4

Please sign in to comment.