diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index d31695831..34f358367 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1129,7 +1129,9 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted data_forget($docker_compose, 'services.' . $this->container_name); $custom_compose = convert_docker_run_to_compose($this->application->custom_docker_run_options); - $docker_compose['services'][$this->application->uuid] = array_merge_recursive($docker_compose['services'][$this->application->uuid], $custom_compose); + if (count($custom_compose) > 0) { + $docker_compose['services'][$this->application->uuid] = array_merge_recursive($docker_compose['services'][$this->application->uuid], $custom_compose); + } $this->docker_compose = Yaml::dump($docker_compose, 10); $this->docker_compose_base64 = base64_encode($this->docker_compose); diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php index e06a9318d..3ebec43b9 100644 --- a/bootstrap/helpers/docker.php +++ b/bootstrap/helpers/docker.php @@ -324,6 +324,8 @@ function isDatabaseImage(?string $image = null) function convert_docker_run_to_compose(?string $custom_docker_run_options = null) { + $options = []; + $compose_options = collect([]); preg_match_all('/(--\w+(?:-\w+)*)(?:\s|=)?([^\s-]+)?/', $custom_docker_run_options, $matches, PREG_SET_ORDER); $list_options = collect([ '--cap-add', @@ -344,7 +346,6 @@ function convert_docker_run_to_compose(?string $custom_docker_run_options = null '--ulimit' => 'ulimits', '--privileged' => 'privileged', ]); - $options = []; foreach ($matches as $match) { $option = $match[1]; $value = isset($match[2]) && $match[2] !== '' ? $match[2] : true; @@ -362,7 +363,6 @@ function convert_docker_run_to_compose(?string $custom_docker_run_options = null } } $options = collect($options); - $compose_options = collect([]); // Easily get mappings from https://github.com/composerize/composerize/blob/master/packages/composerize/src/mappings.js foreach ($options as $option => $value) { if (!data_get($mapping, $option)) {