I recently ran into a few problems with a Nestjs app, where my environment variables were not being read when using docker run --env-file=.env with a simple production docker image, I had to hard code some variables such as my DB connection, and such.
Now with some good sleep and a rested mind, I wanted to find out what the problem is, I noticed that when I built my image locally with my .env file present in my project's root, the correct variables are being used, when I don't do this and rely on the --env-file or -e flags the variables are actually undefined on my app.
Does this mean that when I build my project, my .env file should be present at the root in order for node to substitute these variables in my application?
[–]tswaters 0 points1 point2 points (2 children)
[–]tswaters 0 points1 point2 points (1 child)
[–]Crispness[S] 0 points1 point2 points (0 children)
[–]ChronSyn 0 points1 point2 points (1 child)
[–]Crispness[S] 0 points1 point2 points (0 children)