vcpkg/scripts/azure-pipelines/android/create-docker-image.ps1
Billy O'Neal ba1465e584
Patch Tuesday for February 2024 (#36757)
* Cherry-pick infrastructure changes from
https://github.com/microsoft/vcpkg/pull/36081 as authored by @dg0yt
* Suppress warnings for the monthly docker mint as suggested by Toddy
Mladenov ( MS internal conversation
https://teams.microsoft.com/l/message/19:f498f444e97f40b2a2027d015a9047ab@thread.tacv2/1707520630587?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=2080ccbe-0cfb-49e6-a9c1-ea6a6bf82722&parentMessageId=1707520630587&teamName=Containers%20Secure%20Supply%20Chain&channelName=3P%20Registry%20and%20Images%20Guidance&createdTime=1707520630587
)
* Move Azure Container Registry for Android to WestUS3; with this we are
officially entirely within one Azure region again :D
* Explicitly grant Azure DevOps permissions to touch the scale set
rather than relying on subscription-level assignments.
2024-02-21 16:30:42 -08:00

33 lines
844 B
PowerShell

# Create Docker image for Android
$Date = (Get-Date -Format 'yyyy-MM-dd')
$ResourceGroupName = "PrAnd-1ES"
$ContainerRegistryName = "vcpkgandroidwus3"
$ErrorActionPreference = 'Stop'
$registry = Get-AzContainerRegistry -ResourceGroupName $ResourceGroupName -Name $ContainerRegistryName
Connect-AzContainerRegistry -Name $registry.Name
$imageName = "vcpkg-android"
Push-Location $PSScriptRoot
try {
docker builder prune -f --filter "until=24h"
docker build . -t $imageName
$remote = [string]::Format('{0}.azurecr.io/{1}:{2}', $ContainerRegistryName, $imageName, $Date)
docker tag $imageName $remote
docker push $remote
#removes from local environment
docker rmi --force $remote $imageName
# pulls and runs ...
docker logout
} finally {
Pop-Location
}
Write-Host "Remote: $remote"