We should let users define environment variables w/ their repositories.
Maybe env.txt ? Each line should have <KEY>=<VAL>?
There are two components to this:
env.txt)In general I think we should find whatever heroku does and copy it.
On Jun 27, 2017 10:28 AM, "Chris Holdgraf" notifications@github.com wrote:
We should let users define environment variables w/ their repositories.
Maybe env.txt ? Each line should have
= ? —
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/jupyter/repo2docker/issues/32, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAB23mNnBdVA0O62_E3s31dE5L5M1rcPks5sITvQgaJpZM4OG8pX
.
Heroku uses a .env file.
apologies in advance for bumping this issue, but I ran into this issue as well while converting my old Dockerfile-based repo to the new recommanded way (_ie:_ repo2docker)
My repo uses Go and its Jupyterkernel, so I had to install both.
using postBuild and apt.txt worked fine during the docker image creation.
but when actually running the notebook, I also need to have a few Go related environment variables available ($GOPATH and a couple of entries in $PATH)
it would be valuable to just have a simple declarative way to tell the build system what are the variables to be inherited for the notebook.
so per @yuvipanda 's note above, and from https://devcenter.heroku.com/articles/heroku-local#look-at-the-contents-of-your-env-file,
we could support a file that was just .env and had a structure like:
S3_KEY=mykey
S3_SECRET=mysecret
and it would get inserted at the beginning of the dockerfile
another place where this could be useful: I'm apt-installing some things that get installed to a folder that's not in the typical path. I haven't figured out how to update a path via postBuild so perhaps this could be used for that as well
Before ruling on a file format, maybe a switch could be added to the repo2docker command, e.g. -e ?
I propose that we just go with supporting a file called .env that has {key}={value} pairs, and that will be inserted into the Dockerfile before anything else. It doesn't seem like any other major alternatives have popped up.
I think there are two use cases:
repo2docker as a CLI tool I would like to be able to insert AUTH tokens at launch time (like docker run -e)So I'd champion a command-line option and some file based solution like .env/binder.yaml.
that's a good point @betatim - agreed.
by "I'd champion" are you volunteering a PR? :-)
I'll submit a PR for the flag :-)
@choldgraf @betatim Should we keep this open or close now that #186 has been merged?
I don't think quite yet - that PR hit _part_ of this issue but there are still some extra things to do. I updated the top-level comment with a more specific todo list from my perspective
@choldgraf What kind of documentation would you like ? I can submit a PR but I'm not sure where as the option is documented in the code and the main doc does not have a relevant section (it simply documents the debug and no-build flags) ?
Nothing super long, just a place where the information exists on the web, in case people wonder this to themselves before they download the package. Perhaps a "Can I pass environment variables to repo2docker" the faq or adding a short section covering this in the usage page. Either would be much appreciated!
You can do this with 'start' now that #196 is implemented.
Most helpful comment
I don't think quite yet - that PR hit _part_ of this issue but there are still some extra things to do. I updated the top-level comment with a more specific todo list from my perspective