my-idlers icon indicating copy to clipboard operation
my-idlers copied to clipboard

Dockerfile: Run without .env file

Open m3nu opened this issue 4 years ago • 2 comments

Looks like Laravel doesn't use all container env vars when a .env file is also present. This .env file is used for APP_KEY which is generated and then stored in .env.

This is bad because it stores state inside the container image, which should be disposable. It's also ugly to copy our env vars to a file. This could cause issues when someone e.g. updates the app URL.

Current workaround in run.sh: https://github.com/m3nu/my-idlers/blob/main/run.sh

So would be good to find a setup where no .env file is needed and all settings come from container env vars. Default values could go into the Dockerfile.

m3nu avatar Mar 14 '22 09:03 m3nu

I agree that the .env file is overkill for this project however, at this stage i am not sure of a method to generate/store the APP_KEY that is not .env for those not using docker

cp6 avatar Mar 14 '22 10:03 cp6

Perhaps php artisan key:generate --show and manually add this generated key into the config/app.php

cp6 avatar Mar 14 '22 10:03 cp6