refactor(deployment): update environment file paths in docker compose commands to use working directory for improved consistency

This commit is contained in:
Andras Bacsai
2025-09-15 18:05:11 +02:00
parent 60e31a1381
commit 7322072518

View File

@@ -482,7 +482,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
if (filled($this->env_filename)) {
$services = collect(data_get($composeFile, 'services', []));
$services = $services->map(function ($service, $name) {
$service['env_file'] = ["/artifacts/{$this->env_filename}"];
$service['env_file'] = [$this->env_filename];
return $service;
});
@@ -511,7 +511,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
} else {
$command = "{$this->coolify_variables} docker compose";
if (filled($this->env_filename)) {
$command .= " --env-file /artifacts/{$this->env_filename}";
$command .= " --env-file {$this->workdir}/{$this->env_filename}";
}
if ($this->force_rebuild) {
$command .= " --project-name {$this->application->uuid} --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} build --pull --no-cache";
@@ -557,7 +557,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$command = "{$this->coolify_variables} docker compose";
if (filled($this->env_filename)) {
$command .= " --env-file /artifacts/{$this->env_filename}";
$command .= " --env-file {$server_workdir}/{$this->env_filename}";
}
$command .= " --project-directory {$server_workdir} -f {$server_workdir}{$this->docker_compose_location} up -d";
$this->execute_remote_command(
@@ -574,7 +574,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$command = "{$this->coolify_variables} docker compose";
if ($this->preserveRepository) {
if (filled($this->env_filename)) {
$command .= " --env-file /artifacts/{$this->env_filename}";
$command .= " --env-file {$server_workdir}/{$this->env_filename}";
}
$command .= " --project-name {$this->application->uuid} --project-directory {$server_workdir} -f {$server_workdir}{$this->docker_compose_location} up -d";
$this->write_deployment_configurations();
@@ -584,7 +584,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
);
} else {
if (filled($this->env_filename)) {
$command .= " --env-file /artifacts/{$this->env_filename}";
$command .= " --env-file {$this->workdir}/{$this->env_filename}";
}
$command .= " --project-name {$this->application->uuid} --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} up -d";
$this->execute_remote_command(
@@ -1889,7 +1889,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
],
];
if (filled($this->env_filename)) {
$docker_compose['services'][$this->container_name]['env_file'] = ["/artifacts/{$this->env_filename}"];
$docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename];
}
$docker_compose['services'][$this->container_name]['healthcheck'] = [
'test' => [