Files
dkb/build-and-push.ps1

32 lines
780 B
PowerShell

#requires -Version 5.1
<#
.SYNOPSIS
Bygger og pusher DKB-siden som reg.maximuss.dk/dkb:latest.
#>
[CmdletBinding()]
param(
[string]$Registry = 'reg.maximuss.dk',
[string]$Image = 'dkb-banners',
[string]$Tag = 'latest'
)
$ErrorActionPreference = 'Stop'
$fullName = "$Registry/${Image}:$Tag"
Push-Location $PSScriptRoot
try {
Write-Host "==> Bygger $fullName" -ForegroundColor Cyan
docker build -t $fullName .
if ($LASTEXITCODE -ne 0) { throw "docker build fejlede ($LASTEXITCODE)" }
Write-Host "==> Pusher $fullName" -ForegroundColor Cyan
docker push $fullName
if ($LASTEXITCODE -ne 0) { throw "docker push fejlede ($LASTEXITCODE)" }
Write-Host "==> Færdig: $fullName" -ForegroundColor Green
}
finally {
Pop-Location
}