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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Refactor docker run options to compose format
Andras Bacsai919e88afb4f7
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex d31695831b..34f3583670 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -1129,7 +1129,9 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypteddata_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.phpindex e06a9318dc..3ebec43b99 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.jsforeach ($options as $option => $value) {if (!data_get($mapping, $option)) {