-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathquickstart-image-build.ps1
43 lines (34 loc) · 1.12 KB
/
quickstart-image-build.ps1
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
42
43
# Copyright (c) Microsoft Corproation.
# Licensed under the MIT License.
[CmdletBinding()]
param (
[string] $Registry,
[string] $Repository = "ade",
[string] $Tag = "latest"
)
Write-Host "Logging into specified Azure Container Registry"
az login
az acr login -n $Registry
if (!$?) {
Write-Error "Failed to login to Azure Container Registry"
exit 1
}
Write-Host "Starting Docker Engine"
docker.exe | Out-Null
if (!$?) {
Write-Error "Failed to start Docker Engine. Please make sure Docker is installed on this machine and available in PATH."
exit 1
}
Write-Host "Building Docker Image"
docker build -t "${Registry}.azurecr.io/${Repository}:${Tag}" .
if (!$?) {
Write-Error "Failed to build specified Docker Image. Please check the logs for more details."
exit 1
}
Write-Host "Pushing Docker Image to Azure Container Registry"
docker push "${Registry}.azurecr.io/${Repository}:${Tag}"
if (!$?) {
Write-Error "Failed to push specified Docker Image. Please check the logs for more details."
exit 1
}
Write-Host "Docker Image pushed successfully to ${Registry}.azurecr.io/${Repository}:${Tag}"