Skip to content

Commit 7f46b47

Browse files
authored
Merge pull request #369 from jolicode/push-dry-run
Add a --dry-run option to docker:push command
2 parents d14bd03 + d140d3c commit 7f46b47

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

.castor/docker.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ function run_in_docker_or_locally_for_mac(string $command, ?Context $c = null):
472472
}
473473

474474
#[AsTask(description: 'Push images cache to the registry', namespace: 'docker', name: 'push', aliases: ['push'])]
475-
function push(): void
475+
function push(bool $dryRun = false): void
476476
{
477477
$registry = variable('registry');
478478

@@ -549,6 +549,13 @@ function push(): void
549549
, $target['target'], $target['context'], $target['dockerfile'], $target['reference'], $target['type'], $target['reference'], $target['target'], variable('php_version'));
550550
}
551551

552+
if ($dryRun) {
553+
io()->title('Dry run: Displaying the generated bake file');
554+
io()->write($content);
555+
556+
return;
557+
}
558+
552559
// write bake file in tmp file
553560
$bakeFile = tempnam(sys_get_temp_dir(), 'bake');
554561
file_put_contents($bakeFile, $content);

0 commit comments

Comments
 (0)