forked from OneIdentity/safeguard-ps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
invoke-docker-run.ps1
24 lines (18 loc) · 911 Bytes
/
invoke-docker-run.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
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false,Position=0)]
[string]$ImageType = "alpine"
)
if (-not $PSBoundParameters.ContainsKey("ErrorAction")) { $ErrorActionPreference = "Stop" }
if (-not $PSBoundParameters.ContainsKey("Verbose")) { $VerbosePreference = $PSCmdlet.GetVariableValue("VerbosePreference") }
Import-Module -Name "$PSScriptRoot\docker\docker-include.psm1" -Scope Local -Force
$ImageType = $ImageType.ToLower()
Get-SafeguardDockerFile $ImageType # Make sure the ImageType exists
if (-not (Get-Command "docker" -EA SilentlyContinue))
{
throw "Unabled to find docker command. Is docker installed on this machine?"
}
Write-Host "Rebuilding the image: oneidentity/safeguard-ps:$ImageType ..."
& "$PSScriptRoot/invoke-docker-build.ps1" $ImageType
Write-Host "Building a new image: oneidentity/safeguard-ps:$ImageType ..."
& docker run -it "oneidentity/safeguard-ps:$ImageType"