Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add .env to Dockerfile ? maybe can simple for setup #1

Open
bogordesaincom opened this issue Aug 22, 2022 · 1 comment
Open

Comments

@bogordesaincom
Copy link

How to add .env to Dockerfile ? maybe can simple for setup

@gregmsanderson
Copy link
Owner

Er, well I'd recommend you don't. Since your PaaS (in this case, Fly) should let you specify environment variables. In Fly's case, for non-secret ones, put them in fly.toml in the [env] block. For secret ones, use the separate fly secrets command to set them. Either way, they will be environment variables in your app and be nice and secure.

But if you really need to include an .env ... you could do that by modifying both the .dockerignore (to not ignore it) and then the Dockerfile to copy .env it to the image.

https://github.com/gregmsanderson/fly-hello-wordpress/blob/main/.dockerignore#L5

So add a line there for !.env (use ! to invert. Why? As I've previously ignored all files with *, so then add back only the files we don't want ignored, so in this case you don't want your .env ignored).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants