NEXT_PUBLIC_* exposed in docker containers #1009
Unanswered
adamspotlite
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone! I build my
nextjs
instance in a docker container and have been using theenv.ts
files religiously to much type-safe glee. However, I recently tried to expose someNEXT_PUBLIC_VAR
and that wasn't included on the client, as it seems that those values are inlined at the moment ofnext build
. has anyone else come across this / have a good solution?Use case is trying to expose a firebase config object to the client that gets created as part of the CI/CD pipeline, and ultimately we pass the created env file to docker using
--env-file=.env
.Let me know any thoughts! Thanks.
UPDATE: After quite a while searching, this was by far the best solution I found (tldr; use a context provider with a server function to inject some vars in a safe way).
Beta Was this translation helpful? Give feedback.
All reactions