fix(deploy): keep start-time buildpack vars in runtime env (#12025)

This commit is contained in:
Andras Bacsai
2026-10-14 09:43:55 +02:00
committed by GitHub
parent dc6777a71d
commit d196dd322f
4 changed files with 110 additions and 2 deletions
+19
View File
@@ -40,6 +40,17 @@ class EnvironmentVariable extends BaseModel
public const BUILDPACK_CONTROL_VARIABLE_PREFIXES = ['NIXPACKS_', 'RAILPACK_'];
/**
* Buildpack control variables that the built image reads when the container starts,
* e.g. the Nixpacks PHP prestart script renders nginx.conf from NIXPACKS_PHP_ROOT_DIR.
*/
public const RUNTIME_BUILDPACK_CONTROL_VARIABLES = [
'NIXPACKS_PHP_ROOT_DIR',
'NIXPACKS_PHP_FALLBACK_PATH',
'NIXPACKS_SPA_OUTPUT_DIR',
'RAILPACK_SKIP_MIGRATIONS',
];
protected $attributes = [
'is_runtime' => true,
'is_buildtime' => true,
@@ -159,6 +170,14 @@ class EnvironmentVariable extends BaseModel
return $query;
}
public function scopeWithoutBuildOnlyBuildpackControlVariables(Builder $query): Builder
{
return $query->where(function (Builder $query) {
$query->whereIn('key', self::RUNTIME_BUILDPACK_CONTROL_VARIABLES)
->orWhere(fn (Builder $query) => $query->withoutBuildpackControlVariables());
});
}
public static function isBuildpackControlKey(?string $key): bool
{
if (blank($key)) {