fix(dockerfile): build issue related to asserting existence of next public app url#1644
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Greptile Overview
Summary
Fixed Docker build failure caused by missing NEXT_PUBLIC_APP_URL environment variable during the build stage. The build process requires this variable because next.config.ts accesses env.NEXT_PUBLIC_APP_URL, which triggers validation through @t3-oss/env-nextjs.
The fix follows the existing pattern established for DATABASE_URL by providing a dummy value during build time that runtime environments can override with actual values.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The fix follows the exact same pattern already established for
DATABASE_URLin the same Dockerfile. It provides a dummy environment variable during build time that will be overridden at runtime. The approach is consistent, well-commented, and solves a critical build failure without introducing any new risks. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| docker/app.Dockerfile | 5/5 | Added NEXT_PUBLIC_APP_URL dummy env var for build-time to prevent validation errors in next.config.ts |
Sequence Diagram
sequenceDiagram
participant Docker as Docker Build
participant Dockerfile as app.Dockerfile
participant NextJS as Next.js Build
participant EnvSchema as env.ts (t3-oss)
participant NextConfig as next.config.ts
Docker->>Dockerfile: Start build stage
Dockerfile->>Dockerfile: Set DATABASE_URL dummy
Dockerfile->>Dockerfile: Set NEXT_PUBLIC_APP_URL dummy
Dockerfile->>NextJS: Run `bun run build`
NextJS->>NextConfig: Load next.config.ts
NextConfig->>EnvSchema: Import env (triggers validation)
EnvSchema->>EnvSchema: Validate NEXT_PUBLIC_APP_URL (required)
Note over EnvSchema: With fix: validates successfully<br/>Without fix: throws error
EnvSchema-->>NextConfig: Return validated env
NextConfig->>NextConfig: Access env.NEXT_PUBLIC_APP_URL (lines 85-93, 115)
NextConfig-->>NextJS: Return config
NextJS->>NextJS: Complete build
NextJS-->>Docker: Build artifacts ready
1 file reviewed, no comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Build issue related to asserting existence of next public app url
Type of Change
Testing
Wil test in CI
Checklist