forked from PowerShell/PowerShell-Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateManifest.ps1
49 lines (40 loc) · 1.46 KB
/
createManifest.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
44
45
46
47
48
49
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Used to create a container manifest.
# Prereq: you must login to $ContainerRegistery before running this script
# default scenarios is to build a `latest` tag which will point to the `ubuntu-16.04` tag for linux
# and the `windowsservercore` tag for windows
param(
[parameter(Mandatory)]
[string]
$ContainerRegistry,
[ValidateNotNullOrEmpty()]
[ValidatePattern('^[abcdefghijklmnopqrstuvwxyz\-_0123456789\.]+$')]
[string]
$ManifestTag = 'latest',
[ValidateNotNullOrEmpty()]
[ValidatePattern('^[abcdefghijklmnopqrstuvwxyz\-_0123456789\.]+$')]
[string]
$Image = 'powershell',
[ValidateNotNullOrEmpty()]
[ValidatePattern('^[abcdefghijklmnopqrstuvwxyz\-_0123456789\.]+$')]
[string[]]
$TagList = ('ubuntu-16.04', 'windowsservercore')
)
$first = $true
$manifestList = @()
foreach($tag in $TagList)
{
$amend = ""
if (!$first) {
$amend = '--amend'
}
Write-Verbose -Message "running: docker manifest create $ammend $ContainerRegistry/${Image}:$ManifestTag $ContainerRegistry/${Image}:$tag" -Verbose
docker manifest create $amend $ContainerRegistry/${Image}:$ManifestTag "$ContainerRegistry/${Image}:$tag"
$first = $false
}
# Create the manifest
# Inspect (print) the manifest
docker manifest inspect $ContainerRegistry/${Image}:$ManifestTag
# push the manifest
docker manifest push --purge $ContainerRegistry/${Image}:$ManifestTag