#1899

feat(build): support runtimeInstallCommand in generated builds (#1773)

OpenYK-03wants to merge intofrom

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?: string to BuildConfig.
    • In docker-recipes/php.ts: Executes RUN <runtimeInstallCommand> as root after PHP extension installation and prior to copying the application code and dropping privileges to www-data.
    • In docker-recipes/ruby.ts & generic.ts: Executes RUN <runtimeInstallCommand> in the runtime stage prior to switching to non-root users.
    • In docker-recipes/cache.ts: Included runtimeInstallCommand in build cache key calculation.
  • packages/contracts: Added runtimeInstallCommand to CreateProjectBody (and transitively UpdateProjectBody) and MonorepoSubAppFieldsSchema.
  • packages/db: Added runtimeInstallCommand text column to the project table with migration 0241_runtime_install_command.sql.
  • packages/platform: Persisted runtimeInstallCommand in createProject and updateProject, included it in deployment build snapshots, and passed it to createBuildConfig.
  • apps/dashboard: Added runtimeInstallCommand to project option types and application settings form.
  • Tests: Added test suites verifying runtime stage placement in generated Dockerfiles across recipes and schema validation.