feat(deployments): add support for Coolify variables in Dockerfile
- Introduced functionality to add Coolify variables as ARGs in the Dockerfile during the build process. - Enhanced the existing method to handle both standard environment variables and Coolify-specific variables, improving deployment flexibility.
This commit is contained in:
parent
464b76e597
commit
2f099613a0
1 changed files with 22 additions and 0 deletions
|
|
@ -2890,6 +2890,17 @@ private function add_build_env_variables_to_dockerfile()
|
||||||
$dockerfile->splice(1, 0, ["ARG {$env->key}={$env->real_value}"]);
|
$dockerfile->splice(1, 0, ["ARG {$env->key}={$env->real_value}"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Add Coolify variables as ARGs
|
||||||
|
if ($this->coolify_variables) {
|
||||||
|
$coolify_vars = collect(explode(' ', trim($this->coolify_variables)))
|
||||||
|
->filter()
|
||||||
|
->map(function ($var) {
|
||||||
|
return "ARG {$var}";
|
||||||
|
});
|
||||||
|
foreach ($coolify_vars as $arg) {
|
||||||
|
$dockerfile->splice(1, 0, [$arg]);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Only add preview environment variables that are available during build
|
// Only add preview environment variables that are available during build
|
||||||
$envs = $this->application->environment_variables_preview()
|
$envs = $this->application->environment_variables_preview()
|
||||||
|
|
@ -2903,6 +2914,17 @@ private function add_build_env_variables_to_dockerfile()
|
||||||
$dockerfile->splice(1, 0, ["ARG {$env->key}={$env->real_value}"]);
|
$dockerfile->splice(1, 0, ["ARG {$env->key}={$env->real_value}"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Add Coolify variables as ARGs
|
||||||
|
if ($this->coolify_variables) {
|
||||||
|
$coolify_vars = collect(explode(' ', trim($this->coolify_variables)))
|
||||||
|
->filter()
|
||||||
|
->map(function ($var) {
|
||||||
|
return "ARG {$var}";
|
||||||
|
});
|
||||||
|
foreach ($coolify_vars as $arg) {
|
||||||
|
$dockerfile->splice(1, 0, [$arg]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($envs->isNotEmpty()) {
|
if ($envs->isNotEmpty()) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue