Injecting Variables Through (b)ash
- https://github.com/facebook/create-react-app/issues/2353
- https://www.freecodecamp.org/news/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70/
- https://medium.com/free-code-camp/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70
- https://www.bencode.net/posts/react-build/ <– check
- https://sinclert.github.io/react-env-vars/
- https://gist.github.com/lezhkin11/d6b0a14127b4920feaece278e5323ee1
Using a Multi-stage Dockerfile
Another option is to use a multi-stage Docker file, where the first stage is still using nodeJS, like this. This way node can still parse the environment variables as you would during local development, and the final deployed image is. However, in large organizations deploying such a multistage container in a production environment may irk some SecOps people. See: earthly.dev/blog/docker-multistage/ for some explanation about security concerns.