fix(application): add functionality to stop and remove Docker containers on server
This commit is contained in:
parent
c8f49f29c0
commit
0db2835565
1 changed files with 12 additions and 0 deletions
|
|
@ -231,6 +231,18 @@ protected function setDeploymentUuid()
|
|||
$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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue