Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Build one Docker image and configure it at container start instead of baking NEXT_PUBLIC_* vars at build time. docker-entrypoint.mjs writes all NEXT_PUBLIC_* env vars into public/env-config.js, which is loaded synchronously before React hydrates. config/env.ts reads from window.__ENV__ on the client and process.env (dynamic key access) on the server, so all 58 consumer files remain unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@fmorency is attempting to deploy a commit to the Manifest Network's projects Team on Vercel. A member of the Team first needs to authorize it. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a runtime environment injection mechanism for Docker deployments so the Next.js app can be built once and configured at container start via NEXT_PUBLIC_* variables, rather than requiring build-time .env values.
Changes:
- Adds a Docker entrypoint script that generates
public/env-config.jsfromNEXT_PUBLIC_*variables at container start. - Updates app-side env access to read from
window.__ENV__(client) orprocess.env(server) to avoid build-time inlining. - Updates Docker image build/run workflow and documentation to support runtime configuration.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
docker-entrypoint.mjs |
Generates public/env-config.js from runtime NEXT_PUBLIC_* variables before starting the server. |
Dockerfile |
Switches container startup to run the entrypoint script and ensures public/ is writable. |
config/env.ts |
Introduces getEnvVar() and migrates config reads away from static process.env.NEXT_PUBLIC_* access. |
pages/_document.tsx |
Loads /env-config.js synchronously before hydration to populate window.__ENV__. |
public/env-config.js |
Adds a committed placeholder window.__ENV__ = {} for build/dev consistency. |
README.md |
Documents Docker runtime env injection and provides build/run instructions. |
.github/workflows/_docker-build.yml |
Removes build-time .env generation so images are environment-agnostic. |
CLAUDE.md |
Adds contributor/architecture documentation including the new env handling approach. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…mple Move the Window.__ENV__ augmentation from config/env.ts to global.d.ts where other Window globals are declared. Remove the shell comment in the README docker run example that broke line continuation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Formik async validation can be slow on CI runners, causing the test to exceed the default 5s timeout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The waitFor polling for the button disabled state would hang indefinitely on slow CI runners. Instead, wait for Formik validation to complete (error tooltip appears), then assert button state synchronously. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55384d0 to
56cc134
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces a new runtime environment variable injection system for Docker deployments, allowing the app to be built once and configured at container start for any environment. It removes the need for
.envfiles at build time, updates the environment variable access pattern in the codebase, and adds documentation for the new approach. The most important changes are grouped below.Runtime Environment Injection for Docker:
docker-entrypoint.mjsscript to collect allNEXT_PUBLIC_*environment variables at container start, write them topublic/env-config.jsaswindow.__ENV__, and start the Next.js server.Dockerfileto create a dummy.envat build, ensurepublic/is writable, copydocker-entrypoint.mjs, and use it as the container entrypoint instead of directly starting the server. [1] [2] [3].envcreation step from the GitHub Actions Docker build workflow, making the image environment-agnostic.App Code Changes for New Env Pattern:
config/env.tsto use a newgetEnvVar()helper, reading variables fromwindow.__ENV__in the browser andprocess.envon the server, preventing Next.js from inlining env vars at build time. [1] [2]env-config.jsinpages/_document.tsxto ensurewindow.__ENV__is available before React hydrates.public/env-config.jsfor development and build consistency.Documentation Updates:
README.md, explaining the new runtime env system and how to passNEXT_PUBLIC_*variables at container start.CLAUDE.mdwith project overview, architecture, env handling, and CI details for contributors and Claude Code.