fix(dockerfile): needs dummy db url#1368
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR addresses a Docker build failure by adding dummy database environment variables to the app.Dockerfile. The change introduces DATABASE_URL and POSTGRES_URL environment variables with dummy PostgreSQL connection strings during the Docker build stage.
The implementation uses ARG directives with default dummy values (postgresql://user:pass@localhost:5432/dummy) that can be overridden at build time, then exposes them as ENV variables. This pattern is positioned strategically just before the bun run build command in the builder stage.
The root cause being addressed is that Next.js build processes often perform static analysis and code evaluation that can trigger imports of database modules (like @sim/db). When these modules are loaded, they typically expect database connection environment variables to be present and valid, even though no actual database connection occurs during the build phase. Without these variables, the build process would crash.
This solution follows a common Docker pattern for handling build-time dependencies that require environment variables without affecting runtime behavior. The variables are only present in the builder stage and won't be inherited by the runner stage, ensuring clean separation between build and runtime environments.
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it addresses a specific build failure without affecting runtime behavior
- Score reflects a targeted fix for a common Docker build issue using established patterns, though the dummy URLs could potentially mask real configuration issues in development
- Pay close attention to ensuring runtime environments properly override these dummy values with real database connections
1 file reviewed, no comments
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
Dummy DB URL needed to build and push image.