-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.ps1
40 lines (35 loc) · 1.25 KB
/
publish.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
$dockerHubUsername = "callumwatkins"
$imageName = "dynamicdnsupdater"
$architectures = @("amd64", "arm32v7", "arm64v8")
$versionTag = "1.0.1"
$includeLatestTag = $true
$tags = @($versionTag)
if ($includeLatestTag) {
$tags += "latest"
}
Write-Host "The following tags will be published to ${dockerHubUsername}/${imageName}: {$($architectures -join ', ')}-{$($tags -join ', ')}"
$response = Read-Host "Do you wish to proceed? (yes/no)"
if ($response -ne "yes") {
Write-Host "Operation cancelled by user."
exit
}
foreach ($architecture in $architectures) {
foreach ($tag in $tags) {
$fullTag = "${dockerHubUsername}/${imageName}:${architecture}-${tag}"
Write-Host "Building image for $architecture, version $tag..."
docker build -t $fullTag -f "${architecture}.Dockerfile" .
if ($LASTEXITCODE -eq 0) {
Write-Host "Successfully built $fullTag"
Write-Host "Pushing $fullTag..."
docker push $fullTag
if ($LASTEXITCODE -eq 0) {
Write-Host "Successfully pushed $fullTag"
} else {
Write-Host "Failed to push $fullTag"
}
} else {
Write-Host "Failed to build $fullTag"
}
}
}
Write-Host "Complete."