toddbluhm / env-cmd

Setting environment variables from a file
https://www.npmjs.com/package/env-cmd
MIT License
1.73k stars 65 forks source link

Is it possible to use env-cmd with docker? #353

Open mnai01 opened 1 year ago

mnai01 commented 1 year ago

As of now my package.json build script looks like this.

"scripts": { "build": "env-cmd -e production react-scripts build", },

the problem is when I run a build through docker I get this error

code ELIFECYCLE
errno 1
env-cmd -e production react-script build
Exit status 1

failed to solve: executor failed running [/bin/sh -c npm run build]: exit code: 1

Is there anyway to use env-cmd with docker-compose?