acoustic-garden-40182
05/10/2023, 3:14 PMpants run
. Everything works perfectly. I'm able to pass environment variables in with --docker-run-args="-e MY_VAR=var123"
, and this also works.
However, if I do this --docker-run-args="--env-file .env"
, assuming that the .env file is in the current working directory, I get the following error: docker: open .env: no such file or directory.
Is loading environment variables from a file supported by Pants in this case? I'm on version 2.16.0rc1.curved-television-6568
05/10/2023, 3:29 PM.env
file is not present in the sandbox, meaning there is nothing depending on it to make Pants include it.curved-television-6568
05/10/2023, 3:30 PMrun
is interactive, so the sandbox argument may be moot here…curved-television-6568
05/10/2023, 3:32 PMIs loading environment variables from a file supported by Pants in this case?To answer this, yes, if you use
scie-pants
(the new Pants launcher binary) you can have a .env
file to load env vars from in the root of the repo. Otherwise you can have a .pants.bootstrap
script with export VAR=value
in it which will work in either launcher version (script or binary)acoustic-garden-40182
05/10/2023, 4:45 PM.env
file.