I want to use something like below:
[scripts]
docker_build = "docker build --build-arg PYPI_CREDS=$env:PYPI_CREDS -t myimage:latest ."
Whereas PYPI_CREDS has already been defined and loaded by pipenv from .env file.
I am using windows OS.
Now, it is not able to resolve the env variable passed in docker_build script while running it like pipenv run docker_build
Any solution for this?
Also asked here: https://github.com/pypa/pipenv/issues/3901#issuecomment-952131124
CodePudding user response:
As you've confirmed, pipenv uses cmd.exe, not PowerShell, to launch command lines.
Therefore, you must use cmd.exe's syntax to refer to environment variable PYPI_CREDS, namely %PYPI_CREDS% (rather than PowerShell's syntax, $env:PYPI_CREDS):
[scripts]
docker_build = "docker build --build-arg PYPI_CREDS=%PYPI_CREDS% -t myimage:latest ."
