How to manage environment variables in production build with Turbo
Unanswered
Bahama Swallow posted this in #help-forum
Bahama SwallowOP
I'm currently working on a turborepo project that includes Next.js apps. However, I'm facing an issue with my build process as it's not retrieving my environment variables correctly.
In my Dockerfile, I've sourced all the environment variables from the .envs/.env.build file during the build step using the following command:
RUN . ./.envs/.env.build && yarn build-app
The problem arises when I try to access these variables using process.env.[NEXT_PUBLIC_XXXX] in my code, as it returns undefined.
I would like to avoid using a generic .env.production file because I have multiple dynamic environments that require different sets of variables.
Thank you!
In my Dockerfile, I've sourced all the environment variables from the .envs/.env.build file during the build step using the following command:
RUN . ./.envs/.env.build && yarn build-app
The problem arises when I try to access these variables using process.env.[NEXT_PUBLIC_XXXX] in my code, as it returns undefined.
I would like to avoid using a generic .env.production file because I have multiple dynamic environments that require different sets of variables.
Thank you!