realpython / dockerizing-django

https://realpython.com/blog/python/django-development-with-docker-compose-and-machine/
1.34k stars 484 forks source link

misuse of .env file #36

Open lukeorland opened 8 years ago

lukeorland commented 8 years ago

The .env file at the root of the repo has special use: https://docs.docker.com/compose/env-file/

The file is sourced when docker-compose is invoked, and the values affect docker-compose commands.

My suggestion is to move the contents of the current .env file to docker-compose*.yml, under a new environment: heading.

For reference: https://docs.docker.com/compose/compose-file/#/environment

mjhea0 commented 7 years ago

Would this PR address it? https://github.com/realpython/dockerizing-django/pull/37

imaia commented 7 years ago

37 duplicates the environment variables twice. Would there be a better approach? .env is quite clean, even if not "right".

bmanojlovic commented 7 years ago

I was looking in more elegant way not using .env file but there is no good way to do it without duplicating vars :(.