mirror of
https://github.com/cupcakearmy/coolify.git
synced 2024-10-23 00:24:15 +02:00
fix: pull request build variables
This commit is contained in:
parent
636995d0e4
commit
0eda49b104
@ -657,8 +657,8 @@ private function deploy_pull_request()
|
|||||||
}
|
}
|
||||||
$this->generate_compose_file();
|
$this->generate_compose_file();
|
||||||
// Needs separate preview variables
|
// Needs separate preview variables
|
||||||
// $this->generate_build_env_variables();
|
$this->generate_build_env_variables();
|
||||||
// $this->add_build_env_variables_to_dockerfile();
|
$this->add_build_env_variables_to_dockerfile();
|
||||||
$this->build_image();
|
$this->build_image();
|
||||||
$this->stop_running_container();
|
$this->stop_running_container();
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
@ -810,7 +810,11 @@ private function generate_nixpacks_confs()
|
|||||||
private function nixpacks_build_cmd()
|
private function nixpacks_build_cmd()
|
||||||
{
|
{
|
||||||
$this->generate_env_variables();
|
$this->generate_env_variables();
|
||||||
$nixpacks_command = "nixpacks build --cache-key '{$this->application->uuid}' -o {$this->workdir} {$this->env_args} --no-error-without-start";
|
$cacheKey = $this->application->uuid;
|
||||||
|
if ($this->pull_request_id !== 0) {
|
||||||
|
$cacheKey = "{$this->application->uuid}-pr-{$this->pull_request_id}";
|
||||||
|
}
|
||||||
|
$nixpacks_command = "nixpacks build --cache-key '{$cacheKey}' -o {$this->workdir} {$this->env_args} --no-error-without-start";
|
||||||
if ($this->application->build_command) {
|
if ($this->application->build_command) {
|
||||||
$nixpacks_command .= " --build-cmd \"{$this->application->build_command}\"";
|
$nixpacks_command .= " --build-cmd \"{$this->application->build_command}\"";
|
||||||
}
|
}
|
||||||
@ -1246,10 +1250,16 @@ private function add_build_env_variables_to_dockerfile()
|
|||||||
executeInDocker($this->deployment_uuid, "cat {$this->workdir}{$this->dockerfile_location}"), "hidden" => true, "save" => 'dockerfile'
|
executeInDocker($this->deployment_uuid, "cat {$this->workdir}{$this->dockerfile_location}"), "hidden" => true, "save" => 'dockerfile'
|
||||||
]);
|
]);
|
||||||
$dockerfile = collect(Str::of($this->saved_outputs->get('dockerfile'))->trim()->explode("\n"));
|
$dockerfile = collect(Str::of($this->saved_outputs->get('dockerfile'))->trim()->explode("\n"));
|
||||||
|
if ($this->pull_request_id === 0) {
|
||||||
foreach ($this->application->build_environment_variables as $env) {
|
foreach ($this->application->build_environment_variables as $env) {
|
||||||
$dockerfile->splice(1, 0, "ARG {$env->key}={$env->value}");
|
$dockerfile->splice(1, 0, "ARG {$env->key}={$env->value}");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($this->application->build_environment_variables_preview as $env) {
|
||||||
|
$dockerfile->splice(1, 0, "ARG {$env->key}={$env->value}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ray($dockerfile->implode("\n"));
|
||||||
$dockerfile_base64 = base64_encode($dockerfile->implode("\n"));
|
$dockerfile_base64 = base64_encode($dockerfile->implode("\n"));
|
||||||
$this->execute_remote_command([
|
$this->execute_remote_command([
|
||||||
executeInDocker($this->deployment_uuid, "echo '{$dockerfile_base64}' | base64 -d > {$this->workdir}{$this->dockerfile_location}"),
|
executeInDocker($this->deployment_uuid, "echo '{$dockerfile_base64}' | base64 -d > {$this->workdir}{$this->dockerfile_location}"),
|
||||||
|
Loading…
Reference in New Issue
Block a user