Skip to content

GitHub Action for deploying to Azure Container Instances

Compare
Choose a tag to compare
@mitsha-microsoft mitsha-microsoft released this 17 Mar 06:22
28cafb8

Automate your GitHub Actions workflow to deploy to Azure Container Instances

Usage

Sample workflow to build and deploy a containerized app to Azure Container Instances

on: [push]
name: Linux_Container_Workflow

jobs:
    build-and-deploy:
        runs-on: ubuntu-latest
        steps:
        # checkout the repo
        - name: 'Checkout GitHub Action'
          uses: actions/checkout@master
          
        - name: 'Login via Azure CLI'
          uses: azure/login@v1
          with:
            creds: ${{ secrets.AZURE_CREDENTIALS }}
        
        - uses: azure/docker-login@v1
          with:
            login-server: contoso.azurecr.io
            username: ${{ secrets.REGISTRY_USERNAME }}
            password: ${{ secrets.REGISTRY_PASSWORD }}
        - run: |
            docker build .t contoso.azurecr.io/nodejssampleapp:${{ github.sha }}
            docker push contoso.azurecr.io/nodejssampleapp:${{ github.sha }}

        - name: 'Deploy to Azure Container Instances'
          uses: 'azure/aci-deploy@v1'
          with:
            resource-group: contoso
            dns-name-label: url-for-container
            image: contoso.azurecr.io/nodejssampleapp:${{ github.sha }}
            registry-username: ${{ secrets.REGISTRY_USERNAME }}
            registry-password: ${{ secrets.REGISTRY_PASSWORD }}
            name: contoso-container
            location: 'west us'

License

GitHub Action for deployment to Azure Container Instances is licensed under MIT License