Next.js Discord

Discord Forum

Embedding env values without env files in Dockerfile

Unanswered
gin posted this in #help-forum
Open in Discord
ginOP
Im running into a issue where the env vars i defined in the Dockerfile are not accessible throughout the runner stage.
Is there a workaround to embed vars into the server build in the Dockerfile?

In the builder and installer section the vars are correctly available in the Dockerfile

4 Replies

ginOP
Is there a option for next that creates env files into the standalone build?
Or can i create a env file in the builder stage and copy it with the runner
the env section in the next config is not really a solution cause it also exposes it into the clientside build which i dont want
ginOP
Im trying to find a solution rn