forked from Azure/CloudShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
40 lines (33 loc) · 943 Bytes
/
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
[CmdletBinding()]
param(
[ValidateSet("Tools", "Base", "All")]
[string]$image = "Tools",
[switch]$NoCache
)
$ErrorActionPreference = "Stop"
$args = ""
if ($NoCache) {
$args = "--no-cache"
}
$base = & docker images base_cloudshell
$buildbase = $false
if (! $base) {
Write-Verbose "Base_cloudshell image not found, need to build it"
$buildbase = $true
}
else {
Write-Verbose "Base image found`n$base"
}
if ($image -eq "base" -or $image -eq "all") {
$buildbase = $true
}
if ($buildbase) {
Write-Verbose "Building Base image"
& docker build -t base_cloudshell $args -f linux/base.Dockerfile .
Write-Verbose "Finished building base image"
}
if ($image -eq "tools" -or $image -eq "all") {
Write-verbose "Building tools image"
& docker build -t tools_cloudshell $args --build-arg IMAGE_LOCATION=base_cloudshell -f linux/tools.Dockerfile .
Write-Verbose "Finished building tools image"
}