From 1aea813b7199ea958c5c478836a52491e8ce7c4f Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 14 Oct 2025 17:15:41 +0200 Subject: [PATCH 1/3] Fix static site publish directory double slash in build logs - Strip leading slashes from publish_directory to prevent /app// paths - Only add slash prefix if directory is not empty - Ensures clean Docker COPY paths in build output --- app/Jobs/ApplicationDeploymentJob.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index eafd25e07..27c922233 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -2705,10 +2705,12 @@ private function build_image() ] ); } + $publishDir = ltrim($this->application->publish_directory, '/'); + $publishDir = $publishDir ? "/{$publishDir}" : ''; $dockerfile = base64_encode("FROM {$this->application->static_image} WORKDIR /usr/share/nginx/html/ LABEL coolify.deploymentId={$this->deployment_uuid} -COPY --from=$this->build_image_name /app/{$this->application->publish_directory} . +COPY --from=$this->build_image_name /app{$publishDir} . COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); if (str($this->application->custom_nginx_configuration)->isNotEmpty()) { $nginx_config = base64_encode($this->application->custom_nginx_configuration); From 91e070b2c31c576502e90c45bd13789bfe8f3ef6 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 14 Oct 2025 20:43:11 +0200 Subject: [PATCH 2/3] fix: add missing save_runtime_environment_variables() in deploy_simple_dockerfile Fixes pure Dockerfile deployment failing with 'env file not found' error. The deploy_simple_dockerfile() method was missing the call to save_runtime_environment_variables() which creates the .env file needed during the rolling update phase. This call is present in all other deployment methods (dockerfile, dockercompose, nixpacks, static) but was missing here. This ensures the .env file exists when docker compose tries to use --env-file during the rolling update. --- app/Jobs/ApplicationDeploymentJob.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index eafd25e07..3951de31b 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -491,6 +491,11 @@ private function deploy_simple_dockerfile() $this->generate_build_env_variables(); $this->add_build_env_variables_to_dockerfile(); $this->build_image(); + + // Save runtime environment variables AFTER the build + // This overwrites the build-time .env with ALL variables (build-time + runtime) + $this->save_runtime_environment_variables(); + $this->push_to_docker_registry(); $this->rolling_update(); } From 933a67645f7bf509635be4a661055011ae0b5e37 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 14 Oct 2025 20:45:40 +0200 Subject: [PATCH 3/3] Update app/Jobs/ApplicationDeploymentJob.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- app/Jobs/ApplicationDeploymentJob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 27c922233..ea304af83 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -2705,7 +2705,7 @@ private function build_image() ] ); } - $publishDir = ltrim($this->application->publish_directory, '/'); + $publishDir = trim($this->application->publish_directory, '/'); $publishDir = $publishDir ? "/{$publishDir}" : ''; $dockerfile = base64_encode("FROM {$this->application->static_image} WORKDIR /usr/share/nginx/html/