docker and docker-compose commands

Invoke-DockerCompose which will be the basis of all other future dc
prefixed commands (which currently contains to much copy-pasted code)
This commit is contained in:
lksz 2021-01-13 01:02:37 -05:00
parent 6e56ac6097
commit 24b5e928d0
14 changed files with 183 additions and 17 deletions

View file

@ -9,6 +9,7 @@
[DockerComposeDirs]::_GetValidValues($wordToComplete,$true)
})]
[string[]]$ProjectPath=@($PWD),
[string[]]$UpCliParams,
[Parameter(Position = 0, ValueFromRemainingArguments = $true)]
[string[]]$CliParams
)
@ -20,9 +21,11 @@ if( $CliParams ) {
else { "'$($_.Replace( "'", "''" ))'" }
}
}
$local:dcUpParams = $UpCliParams + $dcParams
$ProjectPath | ForEach-Object {
$local:dcPath = $(Resolve-Path $(Join-Path $_ docker-compose.yml))
Write-Verbose "docker-compose --file $dcPath up -d --remove-orphans $dcParams && docker-compose --file $dcPath logs --follow --tail 10 $dcParams"
docker-compose --file $dcPath up -d --remove-orphans $dcParams && docker-compose --file $dcPath logs --follow --tail 10 $dcParams
Write-Verbose "docker-compose --file $dcPath up -d --remove-orphans $dcUpParams && docker-compose --file $dcPath logs --follow --tail 10 $dcParams"
docker-compose --file $dcPath up -d --remove-orphans $dcUpParams && docker-compose --file $dcPath logs --follow --tail 10 $dcParams
}