mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
refactor: list docker images
This commit is contained in:
parent
557cd55252
commit
40bf9e22b1
2 changed files with 17 additions and 20 deletions
16
app/Actions/Docker/GetServerDockerImageDetails.php
Normal file
16
app/Actions/Docker/GetServerDockerImageDetails.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Actions\Docker;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class GetServerDockerImageDetails
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
public static function run()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -13,25 +13,6 @@ class ListServerDockerImages
|
|||
|
||||
public static function run($server)
|
||||
{
|
||||
|
||||
$jsonString = instant_remote_process(["docker images --format '{{json .}}'"], $server);
|
||||
|
||||
return collect(explode("\n", trim($jsonString)))
|
||||
->filter()
|
||||
->map(function ($line) {
|
||||
$data = json_decode($line, true);
|
||||
if (!$data) return null;
|
||||
|
||||
return [
|
||||
'tag' => $data['Tag'] ?? '<none>',
|
||||
'id' => $data['ID'] ?? '',
|
||||
'created_at' => $data['CreatedAt'] ?? '',
|
||||
'size' => $data['Size'] ?? '',
|
||||
'name' => $data['Repository'] ?? '',
|
||||
];
|
||||
})
|
||||
->filter()
|
||||
->values()
|
||||
->toArray();
|
||||
return format_docker_command_output_to_json(instant_remote_process(["docker images --format '{{json .}}'"], $server));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue