coolify/app/Actions/Server/CleanupDocker.php

33 lines
646 B
PHP
Raw Normal View History

<?php
namespace App\Actions\Server;
use App\Models\Server;
2024-06-10 22:43:34 +02:00
use Lorisleiva\Actions\Concerns\AsAction;
class CleanupDocker
{
use AsAction;
2024-06-10 22:43:34 +02:00
2024-08-21 10:50:05 +02:00
public function handle(Server $server)
{
2024-08-26 12:23:03 +02:00
$commands = $this->getCommands();
foreach ($commands as $command) {
instant_remote_process([$command], $server, false);
}
}
2024-08-26 12:23:03 +02:00
private function getCommands(): array
{
2024-08-09 23:27:39 +02:00
$commonCommands = [
'docker container prune -f --filter "label=coolify.managed=true"',
2024-08-26 12:23:03 +02:00
'docker image prune -af',
'docker builder prune -af',
2024-08-09 23:27:39 +02:00
];
return $commonCommands;
}
}