I have the following project structure locally
|-- docker-compose.yml |-- docker-entrypoint.sh |-- Dockerfile |-- nginx | `-- loc | `-- nginx.conf |-- poetry.lock |-- pyproject.toml `-- src |-- my_project | |-- asgi.py | |-- __init__.py | |-- settings.py | |-- urls.py | `-- wsgi.py |-- __init__.py |-- manage.py |--.env
In Dockerfile I have the following line COPY /src/ /workdir/
Elastic Beanstalk takes env variable and stores them in .env
file by the following path /var/app/current
then when the container has been built, the env file wasn't copied inside. I made a workaround by copying .env
file COPY.env /workdir/
but it doesn't look like a good solution. Should I move everything from /src
folder to one level above?
Make sure you do not have the .env
file in your .gitignore
, .ebignore
, or your .dockerignore
, otherwise it will not get copied.
Here is a link to the Elastic Beanstalk documentation regarding how the .env
file is handled with regards to Docker deployments:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.