mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 21:18:11 -04:00
fix(compose): use explicit compose file paths and remove volumes by name (#12199)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9355728d03
commit
0eeb630ccd
+12
-15
@@ -546,24 +546,21 @@ class Application extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the volumes by the names that Coolify stored.
|
||||
*/
|
||||
public function deleteVolumes()
|
||||
{
|
||||
$persistentStorages = $this->persistentStorages()->get() ?? collect();
|
||||
if ($this->build_pack === 'dockercompose') {
|
||||
$server = data_get($this, 'destination.server');
|
||||
// --project-directory instead of cd: a non-root SSH user cannot enter the directory on the Coolify host.
|
||||
instant_remote_process(["docker compose --project-directory {$this->dirOnServer()} down -v"], $server, false);
|
||||
} else {
|
||||
if ($persistentStorages->count() === 0) {
|
||||
return;
|
||||
}
|
||||
$server = data_get($this, 'destination.server');
|
||||
foreach ($persistentStorages as $storage) {
|
||||
if ($storage->isSharedWithAnotherResource()) {
|
||||
continue;
|
||||
}
|
||||
instant_remote_process(['docker volume rm -f '.escapeshellarg($storage->name)], $server, false);
|
||||
$persistentStorages = $this->persistentStorages()->get();
|
||||
if ($persistentStorages->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
$server = data_get($this, 'destination.server');
|
||||
foreach ($persistentStorages as $storage) {
|
||||
if ($storage->isSharedWithAnotherResource()) {
|
||||
continue;
|
||||
}
|
||||
instant_remote_process(['docker volume rm -f '.escapeshellarg($storage->name)], $server, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user