-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Deployment of the UI app in the container (in kubernetes) mounts the .env file as a secret. All the environment variable defined in .env are exported as env variable in the container. Client side code is build statically, so it inlines the env variable values at the build time. But the container image is public through github actions with no .env files, and due to that the client side codes is statically build with empty values and that result in failure of some UI features.
We can locally build images with the relevant .env files for each deployment environment (qa, prod) and use those images for deployment, but it's too cumbersome and not good practice.
Other option is to ensure we always use app router or getServerSideOpt to get the environment variables as mention in the next.js documentation here.