Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor: Improve Docker Compose parsing for services

Andras Bacsai94de62e503dd
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index 82badc90e7..5c65eb218d 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -1375,13 +1375,17 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
if ($pull_request_id !== 0) {
$name = $name . "-pr-$pull_request_id";
$volume = str("$name:$mount");
- $topLevelVolumes->put($name, [
- 'name' => $name,
- ]);
+ if (!$topLevelVolumes->has($name)) {
+ $topLevelVolumes->put($name, [
+ 'name' => $name,
+ ]);
+ }
} else {
- $topLevelVolumes->put($name->value(), [
- 'name' => $name->value(),
- ]);
+ if (!$topLevelVolumes->has($name->value())) {
+ $topLevelVolumes->put($name->value(), [
+ 'name' => $name->value(),
+ ]);
+ }
}
}
} else {
@@ -1425,9 +1429,11 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
data_set($volume, 'source', $source . ':' . $target);
}
if (!str($source)->startsWith('/')) {
- $topLevelVolumes->put($source, [
- 'name' => $source,
- ]);
+ if (!$topLevelVolumes->has($source)) {
+ $topLevelVolumes->put($source, [
+ 'name' => $source,
+ ]);
+ }
}
}
}