|
2 | 2 | name: (Azure) Сompreface AIB image |
3 | 3 | on: |
4 | 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 }} |
5 | 15 | jobs: |
6 | 16 | build-image: |
7 | 17 | runs-on: ubuntu-latest |
8 | 18 | steps: |
9 | | - - name: Checkout |
10 | | - uses: actions/checkout@v2 |
11 | 19 |
|
12 | 20 | - name: Login via Az module |
13 | 21 | uses: azure/login@v1 |
14 | 22 | with: |
15 | 23 | creds: ${{secrets.AZURE_CREDENTIALS}} |
16 | 24 |
|
17 | | - - name: BUILD-CUSTOM-VM-IMAGE |
| 25 | + - name: Build custom VM image |
| 26 | + id: imageBuilder |
18 | 27 | uses: azure/build-vm-image@v0 |
19 | 28 | with: |
20 | | - resource-group-name: 'myResourceGroup' |
21 | | - managed-identity: 'myImageBuilderIdentity' |
| 29 | + resource-group-name: "${{ env.RESOURCE_GROUP_NAME }}" |
| 30 | + managed-identity: "${{ env.MANAGED_IDENTITY }}" |
22 | 31 | location: 'eastus2' |
23 | | - source-os-type: 'linux' |
24 | | - source-image: Canonical:UbuntuServer:18.04-LTS:latest |
25 | | - customizer-script: | |
26 | | - sh /tmp/workflow-artifacts/install.sh |
| 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' |
27 | 36 | dist-type: 'SharedImageGallery' |
28 | | - dist-resource-id: '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/AppTeam/images/ImagesWithApp' |
| 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 |
29 | 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