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:
parent
6e56ac6097
commit
24b5e928d0
14 changed files with 183 additions and 17 deletions
|
@ -1,11 +1,26 @@
|
|||
#[CmdletBinding(SupportsShouldProcess)]param()
|
||||
[CmdletBinding(SupportsShouldProcess)]param(
|
||||
[ArgumentCompleter({ param (
|
||||
$commandName,
|
||||
$parameterName,
|
||||
$wordToComplete,
|
||||
$commandAst,
|
||||
$fakeBoundParameters
|
||||
)
|
||||
[DockerComposeDirs]::_GetValidValues($wordToComplete,$true)
|
||||
})]
|
||||
[string[]]$ProjectPath=@($PWD),
|
||||
[string[]]$UpCliParams,
|
||||
[Parameter(Position = 0, ValueFromRemainingArguments = $true)]
|
||||
[string[]]$CliParams
|
||||
)
|
||||
|
||||
$local:dcParams = [string]::Empty
|
||||
if( $args ) {
|
||||
$dcParams = $args | ForEach-Object {
|
||||
if( $_ -match "(?:^'[^']+'$)|(?:^`"[^`"]+`"$)|(?:^[^\s]+$)" ) { $_ }
|
||||
else { "'$($_.Replace( "'", "''" ))'" }
|
||||
}
|
||||
$local:passParams = [ordered]@{
|
||||
ProjectPath=$ProjectPath
|
||||
UpCliParams=@('--force-recreate')
|
||||
}
|
||||
docker-compose up -d --force-recreate --remove-orphans $dcParams && docker-compose logs --follow --tail 10 $dcParams
|
||||
if( $UpCliParams ) { $passParams.UpCliParams += $UpCliParams }
|
||||
if( $CliParams ) { $passParams.CliParams = $CliParams }
|
||||
dcup @passParams
|
||||
|
||||
# docker-compose --file $dcPath up -d --force-recreate --remove-orphans $dcParams && docker-compose logs --follow --tail 10 $dcParams
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue