Deploy to Azure Container Instance #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Azure Container Instance | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
- name: 'Login via Azure CLI' | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository | |
- name: Update Azure Container Instance | |
run: | | |
az container update \ | |
--resource-group ${{ secrets.RESOURCE_GROUP }} \ | |
--name ${{ secrets.CONTAINER_GROUP_NAME }} \ | |
--containers name=${{ secrets.CONTAINER_NAME }} image=${{ secrets.REGISTRY_NAME }}/infosys_text-summarization:latest | |
- name: Restart Azure Container Instance | |
run: | | |
az container restart \ | |
--resource-group ${{ secrets.RESOURCE_GROUP }} \ | |
--name ${{ secrets.CONTAINER_GROUP_NAME }} |