2023-12-14 13:50:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Actions\Shared;
|
|
|
|
|
|
|
|
|
|
use App\Models\Service;
|
|
|
|
|
use Lorisleiva\Actions\Concerns\AsAction;
|
|
|
|
|
|
|
|
|
|
class PullImage
|
|
|
|
|
{
|
|
|
|
|
use AsAction;
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2025-01-07 13:52:08 +00:00
|
|
|
public function handle(Service $service)
|
2023-12-14 13:50:38 +00:00
|
|
|
{
|
2025-01-07 13:52:08 +00:00
|
|
|
$service->saveComposeConfigs();
|
2023-12-14 13:50:38 +00:00
|
|
|
|
2025-01-07 13:52:08 +00:00
|
|
|
$commands[] = 'cd '.$service->workdir();
|
|
|
|
|
$commands[] = "echo 'Saved configuration files to {$service->workdir()}.'";
|
2024-07-17 05:59:06 +00:00
|
|
|
$commands[] = 'docker compose pull';
|
2023-12-14 13:50:38 +00:00
|
|
|
|
2025-01-07 13:52:08 +00:00
|
|
|
$server = data_get($service, 'server');
|
2023-12-14 13:50:38 +00:00
|
|
|
|
2024-06-10 20:43:34 +00:00
|
|
|
if (! $server) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-12-14 13:50:38 +00:00
|
|
|
|
2025-01-07 13:52:08 +00:00
|
|
|
instant_remote_process($commands, $service->server);
|
2023-12-14 13:50:38 +00:00
|
|
|
}
|
|
|
|
|
}
|