fix(application): add functionality to stop and remove Docker containers on server

This commit is contained in:
Andras Bacsai
2025-09-11 12:39:28 +02:00
parent c8f49f29c0
commit 0db2835565

View File

@@ -231,6 +231,18 @@ class Previews extends Component
$this->parameters['deployment_uuid'] = $this->deployment_uuid;
}
private function stopContainers(array $containers, $server)
{
$containersToStop = collect($containers)->pluck('Names')->toArray();
foreach ($containersToStop as $containerName) {
instant_remote_process(command: [
"docker stop --time=30 $containerName",
"docker rm -f $containerName",
], server: $server, throwError: false);
}
}
public function stop(int $pull_request_id)
{
$this->authorize('deploy', $this->application);