[email protected]
Twitter
LinkedIn
GitHub
  • Blog
  • GitHub
  • Resume

Build a custom image and distribute them to Azure VMSS using GitHub Actions

September 20, 2021DevOps, TricksNo Commentsjfadev

With the following Github Actions workflow example you build customized images with your app and distribute them using image managing Azure services like Shared Image Gallery After you can use these images for creating Virtual Machines or Virtual Machine Scale Sets 😎

name: Build App Node Image (Azure)

on:
  release:
    types:
      - created

jobs:
  BUILD-APP-NODE-IMAGE:
    runs-on: ubuntu-latest    
    steps:
    - name: CHECKOUT
      uses: actions/[email protected]

    - name: WORKFLOW ARTIFACTS
      run:| 
        cd  "$GITHUB_WORKSPACE"
        mkdir workflow-artifacts/
        cp -r dist workflow-artifacts/dist
        cp install.sh workflow-artifacts/install.sh
      
    - name: AZURE LOGIN 
      uses: azure/[email protected]
      with:
        creds: ${{secrets.AZURE_CREDENTIALS}}

    - name: BUILD VM IMAGE      
      uses: azure/[email protected]
      with:        
        resource-group-name: 'MyApp'
        managed-identity: 'myapp-imagebuilder'
        location: 'westeurope'
        vm-size: 'Standard_D4s_v3'
        source-os-type: 'linux'        
        source-image: Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest
        customizer-source: ${{ GITHUB.WORKSPACE }}/workflow-artifacts
        customizer-script:| 
          sudo mkdir -p /var/www/myapp
          sudo cp -r /tmp/workflow-artifacts/* /var/www/myapp/
          cd /var/www/myapp/
          sudo ./install.sh
        dist-type: 'SharedImageGallery'
        dist-resource-id: '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyApp/providers/Microsoft.Compute/galleries/MyAppImageGallery/images/myapp-node'
        dist-location: 'westeurope'
For more info check this repository:

Github action to create custom virtual machine images that contain artifacts built in CI workflows
https://github.com/Azure/build-vm-image
14 forks.
25 stars.
4 open issues.

Recent commits:
  • merging latest changes from v0 into master, Balaga Gayatri
  • Merge pull request #11 from stephenmahood/masterUpdate supported regions, GitHub
  • Rename issue—bug-report–feature-request.md to bug-report-feature-request.md, GitHub
  • Create auto-triage-issues, GitHub
  • Merge pull request #14 from Azure/users/balaga-gayatri/codeownersCreate CODEOWNERS, GitHub

: Azure, Build Image, Cloud, Deploy, Github Actions, VM, VMSS
jfadev
https://jordifernandes.com
Programmer and Web Developer since 2006. Graduate in Software Engineering in Marseille 15+ years of experience in Web Technologies.

Twitter

My Tweets

Rencent Posts

  • Display a specific Instagram post in WordPress with Jfa Social Media Post
  • Build a custom image and distribute them to Azure VMSS using GitHub Actions
  • PHP-FPM Process Calculator
  • Jfa PWA Toolkit
  • List of backlinks for SEO
  • Full list backlinks generators for SEO positioning
  • Modal Dialog for Material Design Lite
  • Run Symfony2 command from cronjobs in CPanel on a shared host
  • Detecting AdBlock with jQuery or JavaScript
  • Video: Introduction to Apache Cordova in Spanish

Categories

  • Back-End (5)
  • DevOps (1)
  • Front-End (12)
  • Monetization (0)
  • News (8)
  • SEO (2)
  • Tools (6)
  • Tricks (10)
  • Uncategorized (3)

Discover

  • Los Mejores Top 10
  • Slow Fashion Shop
Twitter
LinkedIn
GitHub

© 2013-2022 Jordi Fernandes Alves (@jfadev)