mirror of
https://github.com/tiennm99/coolify.git
synced 2026-09-20 04:23:16 +00:00
fix: docker cleanup job
This commit is contained in:
1 parent
4d7877ce1d
commit
3d73c98779
10 files changed
+231
-179
No files matched your search
@@ -12,29 +12,21 @@ class CleanupDocker
|
||||
public function handle(Server $server)
|
||||
{
|
||||
|
||||
$commands = $this->getCommands($force);
|
||||
$commands = $this->getCommands();
|
||||
|
||||
foreach ($commands as $command) {
|
||||
instant_remote_process([$command], $server, false);
|
||||
}
|
||||
}
|
||||
|
||||
private function getCommands(bool $force): array
|
||||
private function getCommands(): array
|
||||
{
|
||||
$commonCommands = [
|
||||
'docker container prune -f --filter "label=coolify.managed=true"',
|
||||
'docker image prune -f',
|
||||
'docker builder prune -f',
|
||||
'docker image prune -af',
|
||||
'docker builder prune -af',
|
||||
];
|
||||
|
||||
if ($force) {
|
||||
return array_merge([
|
||||
'docker container prune -f --filter "label=coolify.managed=true"',
|
||||
'docker image prune -af',
|
||||
'docker builder prune -af',
|
||||
], $commonCommands);
|
||||
}
|
||||
|
||||
return $commonCommands;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user