Better support for runtime environment variables. #44628
Replies: 1 comment
-
To continue this discussion here: I full agree to the input/request from @svenvandescheur . We're deploying our application to different environments which have a variety of different configurations (endpoints, tokes etc.). The solution right now results in building many identical images in the pipeline with different build args. One build runs 15min including the upload to the registry. With every environment we're adding, we add 15min build time (or resources if run in parallel). This is a mess. For other client side only projects the solution is straight forward. We're using an nginx proxy with |
Beta Was this translation helpful? Give feedback.
-
Describe the feature you'd like to request
When dealing with Docker based deployments on different environments, it's very useful to be able to specify environment variables for thinks like the base url for api calls, or a token for a analytics service.
Currently, it seems that next.js only properly supports specifying environment variables at build time, this leads to the following issue when using Docker.
Describe the solution you'd like
I think there are type of environment variable that need to able to override:
Being able to override the environment variables runtime would solve the first problem, but additional work on the server side render is probably also needed to support these cases properly.
Describe alternatives you've considered
An alternative would be to build specific Docker images for specific environments, however. I think this is considered an anti-pattern and should preferably be avoided.
Beta Was this translation helpful? Give feedback.