Skip to content

Instantly share code, notes, and snippets.

@steviecoaster
Created January 21, 2022 22:17
Show Gist options
  • Save steviecoaster/5d25f511cb2850787974c5cb54e38dfc to your computer and use it in GitHub Desktop.
Save steviecoaster/5d25f511cb2850787974c5cb54e38dfc to your computer and use it in GitHub Desktop.
Quickly spin up Chocolatey's Docker image
function Start-ChocoBuild {
[cmdletBinding()]
Param(
[Parameter()]
[ValidateSet('Debug','Official')]
[String]
$Type = 'Debug'
)
process {
Write-Verbose "Building from $PWD"
$buildType = Switch ($Type) {
'Debug' { 'build.debug.sh'}
'Official' { 'build.official.sh'}
}
$dockerArgs = @('build','-t','choco:latest-linux', '-f','docker/Dockerfile.linux','.','--build-arg',"buildscript=$buildType")
& docker @dockerArgs
}
}
function Start-ChocoContainer {
[Alias('choco')]
[CmdletBinding()]
Param()
process {
Write-Verbose "Running from $PWD"
$dockerArgs = @('run','-ti','--rm','choco:latest-linux','/bin/bash')
docker @dockerArgs
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment