#1899
feat(build): support runtimeInstallCommand in generated builds (#1773)
Fixes #1773.
Problem
Applications utilizing generated Docker recipes (e.g. Laravel / PHP requiring PostgreSQL client pg_dump for spatie/laravel-backup, ImageMagick, or CLI utilities) run as an unprivileged user (e.g., www-data or rails) at runtime. System packages installed during the builder or asset stages are not retained in the final runtime container image, and containers lack root privileges at startup to install system packages on boot.
Solution
Added support for an optional runtimeInstallCommand in generated builds:
packages/adapters:- Added
runtimeInstallCommand?: stringtoBuildConfig. - In
docker-recipes/php.ts: ExecutesRUN <runtimeInstallCommand>as root after PHP extension installation and prior to copying the application code and dropping privileges towww-data. - In
docker-recipes/ruby.ts&generic.ts: ExecutesRUN <runtimeInstallCommand>in the runtime stage prior to switching to non-root users. - In
docker-recipes/cache.ts: IncludedruntimeInstallCommandin build cache key calculation.
- Added
packages/contracts: AddedruntimeInstallCommandtoCreateProjectBody(and transitivelyUpdateProjectBody) andMonorepoSubAppFieldsSchema.packages/db: AddedruntimeInstallCommandtext column to theprojecttable with migration0241_runtime_install_command.sql.packages/platform: PersistedruntimeInstallCommandincreateProjectandupdateProject, included it in deployment build snapshots, and passed it tocreateBuildConfig.apps/dashboard: AddedruntimeInstallCommandto project option types and application settings form.- Tests: Added test suites verifying runtime stage placement in generated Dockerfiles across recipes and schema validation.