mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-18 00:23:14 +00:00
Merge remote-tracking branch 'origin/next' into 7616-conditional-image-tags
This commit is contained in:
@@ -197,7 +197,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||
|
||||
public function __construct(public int $application_deployment_queue_id)
|
||||
{
|
||||
$this->onQueue('high');
|
||||
$this->onQueue(deployment_queue());
|
||||
|
||||
$this->application_deployment_queue = ApplicationDeploymentQueue::find($this->application_deployment_queue_id);
|
||||
$this->nixpacks_plan_json = collect([]);
|
||||
@@ -1302,12 +1302,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||
$sorted_environment_variables_preview = $this->application->runtime_environment_variables_preview->sortBy('id');
|
||||
}
|
||||
if ($this->build_pack === 'dockercompose') {
|
||||
$sorted_environment_variables = $sorted_environment_variables->filter(function ($env) {
|
||||
return ! str($env->key)->startsWith('SERVICE_FQDN_') && ! str($env->key)->startsWith('SERVICE_URL_') && ! str($env->key)->startsWith('SERVICE_NAME_');
|
||||
});
|
||||
$sorted_environment_variables_preview = $sorted_environment_variables_preview->filter(function ($env) {
|
||||
return ! str($env->key)->startsWith('SERVICE_FQDN_') && ! str($env->key)->startsWith('SERVICE_URL_') && ! str($env->key)->startsWith('SERVICE_NAME_');
|
||||
});
|
||||
$sorted_environment_variables = $sorted_environment_variables->reject(fn (EnvironmentVariable $env) => $this->isGeneratedDockerComposeEnvironmentVariable($env));
|
||||
$sorted_environment_variables_preview = $sorted_environment_variables_preview->reject(fn (EnvironmentVariable $env) => $this->isGeneratedDockerComposeEnvironmentVariable($env));
|
||||
}
|
||||
$ports = $this->application->main_port();
|
||||
$coolify_envs = $this->generate_coolify_env_variables();
|
||||
@@ -1460,6 +1456,15 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||
return $envs;
|
||||
}
|
||||
|
||||
private function isGeneratedDockerComposeEnvironmentVariable(EnvironmentVariable $environmentVariable): bool
|
||||
{
|
||||
$key = str($environmentVariable->key);
|
||||
|
||||
return $key->startsWith('SERVICE_FQDN_')
|
||||
|| $key->startsWith('SERVICE_URL_')
|
||||
|| $key->startsWith('SERVICE_NAME_');
|
||||
}
|
||||
|
||||
private function save_runtime_environment_variables()
|
||||
{
|
||||
// This method saves the .env file with ALL runtime variables
|
||||
@@ -1675,11 +1680,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||
->orderBy($this->application->settings->is_env_sorting_enabled ? 'key' : 'id')
|
||||
->get();
|
||||
|
||||
// For Docker Compose, filter out SERVICE_FQDN and SERVICE_URL as we generate these
|
||||
// For Docker Compose, filter out generated SERVICE_* variables as we generate these
|
||||
if ($this->build_pack === 'dockercompose') {
|
||||
$sorted_environment_variables = $sorted_environment_variables->filter(function ($env) {
|
||||
return ! str($env->key)->startsWith('SERVICE_FQDN_') && ! str($env->key)->startsWith('SERVICE_URL_');
|
||||
});
|
||||
$sorted_environment_variables = $sorted_environment_variables->reject(fn (EnvironmentVariable $env) => $this->isGeneratedDockerComposeEnvironmentVariable($env));
|
||||
}
|
||||
|
||||
foreach ($sorted_environment_variables as $env) {
|
||||
@@ -1728,11 +1731,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||
->orderBy($this->application->settings->is_env_sorting_enabled ? 'key' : 'id')
|
||||
->get();
|
||||
|
||||
// For Docker Compose, filter out SERVICE_FQDN and SERVICE_URL as we generate these with PR-specific values
|
||||
// For Docker Compose, filter out generated SERVICE_* variables as we generate these with PR-specific values
|
||||
if ($this->build_pack === 'dockercompose') {
|
||||
$sorted_environment_variables = $sorted_environment_variables->filter(function ($env) {
|
||||
return ! str($env->key)->startsWith('SERVICE_FQDN_') && ! str($env->key)->startsWith('SERVICE_URL_');
|
||||
});
|
||||
$sorted_environment_variables = $sorted_environment_variables->reject(fn (EnvironmentVariable $env) => $this->isGeneratedDockerComposeEnvironmentVariable($env));
|
||||
}
|
||||
|
||||
foreach ($sorted_environment_variables as $env) {
|
||||
@@ -3028,6 +3029,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
||||
->where('is_buildtime', true)
|
||||
->get();
|
||||
|
||||
if ($this->build_pack === 'dockercompose') {
|
||||
$envs = $envs->reject(fn (EnvironmentVariable $env) => $this->isGeneratedDockerComposeEnvironmentVariable($env));
|
||||
}
|
||||
|
||||
foreach ($envs as $env) {
|
||||
$resolvedValue = $env->getResolvedValueWithServer($this->mainServer);
|
||||
if (! is_null($resolvedValue)) {
|
||||
@@ -3040,6 +3045,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
||||
->where('is_buildtime', true)
|
||||
->get();
|
||||
|
||||
if ($this->build_pack === 'dockercompose') {
|
||||
$envs = $envs->reject(fn (EnvironmentVariable $env) => $this->isGeneratedDockerComposeEnvironmentVariable($env));
|
||||
}
|
||||
|
||||
foreach ($envs as $env) {
|
||||
$resolvedValue = $env->getResolvedValueWithServer($this->mainServer);
|
||||
if (! is_null($resolvedValue)) {
|
||||
|
||||
Reference in New Issue
Block a user