-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDeploy-App.ps1
More file actions
41 lines (26 loc) · 1.58 KB
/
Deploy-App.ps1
File metadata and controls
41 lines (26 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
param
(
[Parameter(Mandatory = $true)]
[string]$InfrastructureOutputsPath
)
$InfrastructureOutputs = Get-Content -Path $InfrastructureOutputsPath -Raw | ConvertFrom-Json
$AzureResourceGroup = $InfrastructureOutputs.environmentInfo.value.azureResourceGroup
$ContainerRegistryName = $InfrastructureOutputs.environmentInfo.value.containerRegistryName
$ContainerName = $InfrastructureOutputs.environmentInfo.value.applicationName
$ContainerAppName = $InfrastructureOutputs.environmentInfo.value.applicationContainerAppName
$ContainerVersion = (Get-Date -Format "yyMMddHHmm")
$ContainerImageName = "${ContainerName}:${ContainerVersion}"
$AzureContainerImageName = "${ContainerRegistryName}.azurecr.io/${ContainerImageName}"
Push-Location -Path $PSScriptRoot
Write-Host "Starting ${ContainerName} deployment..."
az --version
Write-Host "Building ${ContainerImageName} image..."
az acr login --name $ContainerRegistryName --resource-group $AzureResourceGroup
docker build -t $ContainerImageName -f ../../src/AIDocumentPipeline/Dockerfile ../../src/AIDocumentPipeline/.
Write-Host "Pushing ${ContainerImageName} image to Azure..."
docker tag $ContainerImageName $AzureContainerImageName
docker push $AzureContainerImageName
Write-Host "Deploying Azure Container Apps for ${ContainerName}..."
$acrLogin = $(az acr show --name $ContainerRegistryName --resource-group $AzureResourceGroup -o json | ConvertFrom-Json).loginServer
az containerapp update --name $ContainerAppName --resource-group $AzureResourceGroup --image "$acrLogin/$ContainerImageName" --revision-suffix $ContainerVersion
Pop-Location