|
| 1 | +--- |
| 2 | +name: (Azure) Сompreface AIB image |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: Version (e.g., 1.0.0) |
| 8 | + required: true |
| 9 | +env: |
| 10 | + RESOURCE_GROUP_NAME: compreFaceGallery-RG |
| 11 | + MANAGED_IDENTITY: compreFace-SP |
| 12 | + GALLERY_NAME: compreFaceGallery |
| 13 | + IMAGE_NAME: compreFace |
| 14 | + VERSION: ${{ github.event.inputs.version }} |
| 15 | +jobs: |
| 16 | + build-image: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + |
| 20 | + - name: Login via Az module |
| 21 | + uses: azure/login@v1 |
| 22 | + with: |
| 23 | + creds: ${{secrets.AZURE_CREDENTIALS}} |
| 24 | + |
| 25 | + - name: Build custom VM image |
| 26 | + id: imageBuilder |
| 27 | + uses: azure/build-vm-image@v0 |
| 28 | + with: |
| 29 | + resource-group-name: "${{ env.RESOURCE_GROUP_NAME }}" |
| 30 | + managed-identity: "${{ env.MANAGED_IDENTITY }}" |
| 31 | + location: 'eastus2' |
| 32 | + source-os-type: 'linux' |
| 33 | + source-image-type: 'PlatformImage' |
| 34 | + source-image: Canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:latest |
| 35 | + vm-size: 'Standard_B2s' |
| 36 | + dist-type: 'SharedImageGallery' |
| 37 | + dist-resource-id: "/subscriptions/${{secrets.AZURE_SUBSCRIPTION_ID}}/resourceGroups/${{ env.RESOURCE_GROUP_NAME }}/providers/Microsoft.Compute/galleries/${{ env.GALLERY_NAME }}/images/${{ env.IMAGE_NAME }}/versions/${VERSION}" #Replace with the resource id of your shared image gallery's image definition |
| 38 | + dist-location: 'eastus2' |
| 39 | + customizer-script: | |
| 40 | + apt update |
| 41 | + apt upgrade -y |
| 42 | + apt install -y docker.io unzip |
| 43 | + docker version |
| 44 | + curl -L 'https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)' -o /usr/local/bin/docker-compose |
| 45 | + chmod +x /usr/local/bin/docker-compose |
| 46 | + docker-compose version |
| 47 | + wget -q -O tmp.zip "https://github.com/exadel-inc/CompreFace/releases/download/v${{ env.VERSION }}/CompreFace_${{ env.VERSION }}.zip" && unzip tmp.zip && rm tmp.zip |
| 48 | + chmod 666 /var/run/docker.sock |
| 49 | + docker-compose pull --quiet |
| 50 | + docker-compose up -d |
| 51 | + /usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync |
0 commit comments