-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-build.ps1
42 lines (30 loc) · 972 Bytes
/
docker-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
# ./docker-build.ps1 run push
param ($run, $push)
start powershell -wait {./local-certs/makecert.ps1}
$tagName = "jamesgoulddev/azure-keyvault-emulator"
$version = "latest"
write-host "Executing docker build with tag: $tagName"
try { docker build --tag ${tagName}:${version} . }
catch { "Build failed" }
if($run -and !$error)
{
write-host "Running docker container, param run has value $run"
docker run -p 80:8080 --name keyvault-emulator ${tagName}
}
else
{
if($error)
{
write-host "Failed to build image, exiting script."
exit
}
write-host "Build complete, ready and available in your local container images."
}
if ($push -and !$error)
{
write-host "Pushing to public docker registry: $tagName with version: $version"
$error.clear()
try { docker push ${tagName}:${version} }
catch { "Push failed" }
}
if($error) { "You do not have permissions to push to the registry, or are not logged in!" }