Skip to content

fix(docker): restore DATABASE_URL build ARG for prisma generate#5

Merged
Yaugourt merged 1 commit into
mainfrom
fix/dockerfile-prisma-database-url
May 31, 2026
Merged

fix(docker): restore DATABASE_URL build ARG for prisma generate#5
Yaugourt merged 1 commit into
mainfrom
fix/dockerfile-prisma-database-url

Conversation

@Yaugourt

Copy link
Copy Markdown
Owner

Hotfix for Railway build failure introduced by #4.

PrismaConfigEnvError: Cannot resolve environment variable: DATABASE_URL

prisma.config.ts (Prisma 7+) resolves env(DATABASE_URL) at config load time, so even prisma generate needs the var to be defined. My audit fix dropped the ARG thinking only migrate deploy needed it — wrong for the config-file flow.

Restored ARG DATABASE_URL with a dummy default (postgresql://build:build@localhost:5432/build). Build succeeds without Railway secrets. Runtime still reads the real one from process.env at startup, untouched.

The other hardening from #4 (USER node, HEALTHCHECK, .dockerignore, --chown) stays in place.

…risma generate

prisma.config.ts (Prisma 7+) resolves env(DATABASE_URL) at config load time,
so even `prisma generate` fails with PrismaConfigEnvError if the variable is
unset. Restore ARG DATABASE_URL but default it to a dummy localhost URL so the
build succeeds without depending on Railway injecting a secret build arg. The
real DATABASE_URL is still injected by Railway as a runtime env var, the
runtime container reads it from process.env at startup.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Yaugourt Yaugourt merged commit 063b321 into main May 31, 2026
1 check passed
@Yaugourt Yaugourt deleted the fix/dockerfile-prisma-database-url branch May 31, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant