fix: Stop resources gracefully

This commit is contained in:
Andras Bacsai
2024-08-06 13:27:06 +02:00
parent 35e62a3003
commit e897eb2999
4 changed files with 15 additions and 13 deletions

View File

@@ -31,15 +31,13 @@ class StopApplication
} else {
$containers = getCurrentApplicationContainerStatus($server, $application->id, 0);
}
ray($containers);
if ($containers->count() > 0) {
foreach ($containers as $container) {
$containerName = data_get($container, 'Names');
if ($containerName) {
instant_remote_process(
["docker rm -f {$containerName}"],
$server
);
instant_remote_process(command: ["docker stop --time=30 $containerName"], server: $server, throwError: false);
instant_remote_process(command: ["docker rm $containerName"], server: $server, throwError: false);
instant_remote_process(command: ["docker rm -f {$containerName}"], server: $server, throwError: false);
}
}
}