lasthourcloud/app/Actions/Shared/PullImage.php

29 lines
593 B
PHP
Raw Normal View History

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
2023-12-14 13:50:38 +00:00
public function handle(Service $resource)
{
$resource->saveComposeConfigs();
2024-06-10 20:43:34 +00:00
$commands[] = 'cd '.$resource->workdir();
2023-12-14 13:50:38 +00:00
$commands[] = "echo 'Saved configuration files to {$resource->workdir()}.'";
2024-07-17 05:59:06 +00:00
$commands[] = 'docker compose pull';
2023-12-14 13:50:38 +00:00
$server = data_get($resource, 'server');
2024-06-10 20:43:34 +00:00
if (! $server) {
return;
}
2023-12-14 13:50:38 +00:00
instant_remote_process($commands, $resource->server);
}
}