How to give environment variables at run time while running a docker image?
Unanswered
devv posted this in #help-forum
devvOP
I have an app which would have a different environment for each deployment.
So it makes sense to build its docker images such that I only build a version of this app and pass environment variables while running the container instead of building the image with the environment.
But in the documentation it says that environment variables are replaced at build time. Is there any way I can do this?
(I am using nextjs app router)
So it makes sense to build its docker images such that I only build a version of this app and pass environment variables while running the container instead of building the image with the environment.
But in the documentation it says that environment variables are replaced at build time. Is there any way I can do this?
(I am using nextjs app router)
2 Replies
@devv I have an app which would have a different environment for each deployment.
So it makes sense to build its docker images such that I only build a version of this app and pass environment variables while running the container instead of building the image with the environment.
But in the documentation it says that environment variables are replaced at build time. Is there any way I can do this?
(I am using nextjs app router)
Server side environment variables: it just works.
Client side environment variables (
Client side environment variables (
NEXT_PUBLIC): https://www.npmjs.com/package/next-runtime-envdevvOP
Thanks man I'll check this out and let u know