fix(laravel): apply runtime DB config and startup entrypoint

Laravel images no longer bake config:cache at build time, which ignored
K8s DB env vars. Add DB_CONNECTION, clear config on boot, generate APP_KEY
when missing, run migrations, and rebuild caches at container start.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-15 00:30:17 +03:30
parent cca6cdc1a5
commit 5fd4069821
4 changed files with 41 additions and 33 deletions
@@ -435,7 +435,14 @@ export class KubernetesService implements OnModuleInit {
(ctx.runtime === AppRuntime.LARAVEL || ctx.runtime === AppRuntime.PHP) &&
ctx.databaseType !== DatabaseType.NONE
) {
const dbConnection =
ctx.databaseType === DatabaseType.POSTGRESQL
? 'pgsql'
: ctx.databaseType === DatabaseType.MONGODB
? 'mongodb'
: 'mysql';
extraEnv.push(
{ name: 'DB_CONNECTION', value: dbConnection },
{ name: 'DB_DATABASE', value: ctx.appName.replace(/-/g, '_') },
{ name: 'DB_USERNAME', valueFrom: { secretKeyRef: { name: `${ctx.appName}-db-secret`, key: 'username' } } },
);