t3-oss / t3-env

https://env.t3.gg
MIT License
2.78k stars 86 forks source link

Issue with Loading Environment Variables in Docker Container #244

Closed mehrabmp closed 4 months ago

mehrabmp commented 5 months ago

When I run my app using Docker, I get errors like "Invalid environment" for all my environment variables in the browser console. However, I'm certain that my environment variables are loaded into the container, as I have verified using the docker exec bash command. The issue I noticed is that when I build my image with the .env file included, everything works fine. However, when I add .env to .dockerignore, I encounter this problem. It seems that the library only works with .env files and cannot get environment variables from the system or the Docker container.

michielswaanen commented 5 months ago

Experiencing the same issue after upgrading to Docker 4.30.0. I'm not sure if it's related to the upgrade.

robodove commented 5 months ago

Are you using turborepo to build/run ?

https://turbo.build/repo/docs/reference/run#--env-mode-option

Turbo --env-mode is strict by default (only env variables specified in the config are passed to the container)

Using

$ turbo run build --env-mode loose

fixes this

mehrabmp commented 5 months ago

Are you using turborepo to build/run ?

https://turbo.build/repo/docs/reference/run#--env-mode-option

Turbo --env-mode is strict by default (only env variables specified in the config are passed to the container)

Using

$ turbo run build --env-mode loose

fixes this

No I'm using create-t3-app

robodove commented 5 months ago

Are you using turborepo to build/run ? https://turbo.build/repo/docs/reference/run#--env-mode-option Turbo --env-mode is strict by default (only env variables specified in the config are passed to the container) Using

$ turbo run build --env-mode loose

fixes this

No I'm using create-t3-app

that has nothing to do with deployment ?

Check your Dockerfile / Docker commands if it contains "turbo"..

juliusmarminge commented 4 months ago

I don't think this is related to this library.

You need to: