refactor: Add conditional check for volumes in generate_compose_file()
This commit is contained in:
parent
29192a79d0
commit
1069e33601
1 changed files with 6 additions and 3 deletions
|
|
@ -1728,14 +1728,17 @@ private function generate_compose_file()
|
|||
if (count($this->application->ports_mappings_array) > 0 && $this->pull_request_id === 0) {
|
||||
$docker_compose['services'][$this->container_name]['ports'] = $this->application->ports_mappings_array;
|
||||
}
|
||||
if (! data_get($docker_compose, 'services.'.$this->container_name.'.volumes')) {
|
||||
$docker_compose['services'][$this->container_name]['volumes'] = [];
|
||||
}
|
||||
|
||||
if (count($persistent_storages) > 0) {
|
||||
if (! data_get($docker_compose, 'services.'.$this->container_name.'.volumes')) {
|
||||
$docker_compose['services'][$this->container_name]['volumes'] = [];
|
||||
}
|
||||
$docker_compose['services'][$this->container_name]['volumes'] = array_merge($docker_compose['services'][$this->container_name]['volumes'], $persistent_storages);
|
||||
}
|
||||
if (count($persistent_file_volumes) > 0) {
|
||||
if (! data_get($docker_compose, 'services.'.$this->container_name.'.volumes')) {
|
||||
$docker_compose['services'][$this->container_name]['volumes'] = [];
|
||||
}
|
||||
$docker_compose['services'][$this->container_name]['volumes'] = array_merge($docker_compose['services'][$this->container_name]['volumes'], $persistent_file_volumes->map(function ($item) {
|
||||
return "$item->fs_path:$item->mount_path";
|
||||
})->toArray());
|
||||
|
|
|
|||
Loading…
Reference in a new issue