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

Support for .env files #179

Closed
vladaionescu opened this issue Aug 13, 2020 · 7 comments · Fixed by #248
Closed

Support for .env files #179

vladaionescu opened this issue Aug 13, 2020 · 7 comments · Fixed by #248
Assignees
Labels
type:enhancement Small feature requests / adjustments

Comments

@vladaionescu
Copy link
Member

vladaionescu commented Aug 13, 2020

A feature request is the support for .env files (similar to how compose uses them https://docs.docker.com/compose/env-file/).

It might work like this: if an .env file is present in the current dir, or any dir above the current dir (dirs closer to current dir have higher precendence), load the vars and pass them to the build as both build-args AND secrets. EDIT: Using the .env in the current dir only seems to be the the behavior most similar to how other tools work.

CC @zenyui

@vladaionescu vladaionescu added the type:enhancement Small feature requests / adjustments label Aug 13, 2020
@zenyui
Copy link
Contributor

zenyui commented Aug 25, 2020

this aligns well with docker-compose local dev, as it's a common pattern to supply a .env for easy propagation of environment variables into containers. It would be especially helpful for passing in development secrets to earth, as it would eliminate the need for pre-setting those values as env vars or passing into the build command as plaintext.

@vladaionescu vladaionescu self-assigned this Aug 25, 2020
@vladaionescu
Copy link
Member Author

Indeed - we've been debating whether to support this because we have upcoming cloud-based features that serve the same use-case. But I think it's still worth doing it, as not everyone will be comfortable with hosting secrets outside their own environment.

@vladaionescu
Copy link
Member Author

This will go in next week's release, @zenyui

@winmillwill
Copy link

@vladaionescu what is the implication of copying a potentially secret environment variable from .env to the build args? Do those build args not show up in the image history or similar? What's the motivation for copying to both build args and secrets?

@vladaionescu
Copy link
Member Author

The build args only show up in the history if they are declared as such via ARG. But if an arg is passed on the command-line, but is never used in the build with an ARG declaration, then it will not show up.

@frafra
Copy link

frafra commented Apr 11, 2022

Might I add that using .env files for earthly clashes with using .env files for docker compose? I was a bit puzzled to see my .env variables in the output produced by earthly (passwords too).

@alexcb
Copy link
Collaborator

alexcb commented Apr 13, 2022

@frafra I opened #1736 to track env variables being output when a target doesn't exist (or interupted by ctrl-c).

If there's another case where they are displayed when not explicitly requested via an ARG ..., would you mind opening a new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Small feature requests / adjustments
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants