fix: use nixpacks predefined build variables, but still could update the default values from Coolify
This commit is contained in:
@@ -126,6 +126,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
private ?string $nixpacks_plan = null;
|
private ?string $nixpacks_plan = null;
|
||||||
|
|
||||||
|
private Collection $nixpacks_plan_json;
|
||||||
|
|
||||||
private ?string $nixpacks_type = null;
|
private ?string $nixpacks_type = null;
|
||||||
|
|
||||||
private string $dockerfile_location = '/Dockerfile';
|
private string $dockerfile_location = '/Dockerfile';
|
||||||
@@ -1545,7 +1547,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
// Do any modifications here
|
// Do any modifications here
|
||||||
$this->generate_env_variables();
|
$this->generate_env_variables();
|
||||||
$merged_envs = $this->env_args->merge(collect(data_get($parsed, 'variables', [])));
|
$merged_envs = collect(data_get($parsed, 'variables', []))->merge($this->env_args);
|
||||||
$aptPkgs = data_get($parsed, 'phases.setup.aptPkgs', []);
|
$aptPkgs = data_get($parsed, 'phases.setup.aptPkgs', []);
|
||||||
if (count($aptPkgs) === 0) {
|
if (count($aptPkgs) === 0) {
|
||||||
$aptPkgs = ['curl', 'wget'];
|
$aptPkgs = ['curl', 'wget'];
|
||||||
@@ -1570,6 +1572,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->elixir_finetunes();
|
$this->elixir_finetunes();
|
||||||
}
|
}
|
||||||
$this->nixpacks_plan = json_encode($parsed, JSON_PRETTY_PRINT);
|
$this->nixpacks_plan = json_encode($parsed, JSON_PRETTY_PRINT);
|
||||||
|
$this->nixpacks_plan_json = collect($parsed);
|
||||||
$this->application_deployment_queue->addLogEntry("Final Nixpacks plan: {$this->nixpacks_plan}", hidden: true);
|
$this->application_deployment_queue->addLogEntry("Final Nixpacks plan: {$this->nixpacks_plan}", hidden: true);
|
||||||
if ($this->nixpacks_type === 'rust') {
|
if ($this->nixpacks_type === 'rust') {
|
||||||
// temporary: disable healthcheck for rust because the start phase does not have curl/wget
|
// temporary: disable healthcheck for rust because the start phase does not have curl/wget
|
||||||
@@ -2278,18 +2281,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
|
|
||||||
private function generate_build_env_variables()
|
private function generate_build_env_variables()
|
||||||
{
|
{
|
||||||
$this->build_args = collect(["--build-arg SOURCE_COMMIT=\"{$this->commit}\""]);
|
$variables = collect($this->nixpacks_plan_json->get('variables'));
|
||||||
if ($this->pull_request_id === 0) {
|
$this->build_args = $variables->map(function ($value, $key) {
|
||||||
foreach ($this->application->build_environment_variables as $env) {
|
return "--build-arg {$key}={$value}";
|
||||||
$value = escapeshellarg($env->real_value);
|
});
|
||||||
$this->build_args->push("--build-arg {$env->key}={$value}");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach ($this->application->build_environment_variables_preview as $env) {
|
|
||||||
$value = escapeshellarg($env->real_value);
|
|
||||||
$this->build_args->push("--build-arg {$env->key}={$value}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_build_env_variables_to_dockerfile()
|
private function add_build_env_variables_to_dockerfile()
|
||||||
|
|||||||
Reference in New Issue
Block a user