.env file present on host is not exposed inside Docker container
P.S.: Be careful not to mess with Docker production deployments
Edit: Adding env_file to Docker-compose I don’t think it brings real-time sync, one would need to stop the container and start again. Would be great to bind-mount it to get real-time updates coupled with dotenv
Hi.
I am not very good at docker, just know what to do to make things work.
To use an env file with docker, we add its path manually in the dockerfile in .wappler project definition folder.
Then, deploy.
Any change in env variable requires a restart of docker container or redeploy.
This is because env variables cannot be changed on the fly from what I know. Don’t know if mounting thing as you suggest would work.
If using a local node server in Wappler, any change in the .env file defined in root folder, requires restart of local server as well.
When you change a file (e.g.: Server Action), nodemon restarts the NodeJS server, so in theory .env variables could be loaded in real-time as well. Currently, a Docker container restart/re-deploy is needed because your method uses Docker to inject environment variables, but Wappler's NodeJS can load from .env file directly (it uses dotenv library) instead of relying on Docker