I'm building a dockerized React application and need to define some environment variables for API URLs. However, React inject those variables in the build phase, so I need to rebuild the whole image every time the environment changes. This slows down my pipeline, as I can't reuse the same app image for homologation and production.
I've searched for some patterns and I'm now using a JS config file to inject the environment on the fly, but it doesn't look very straightforward. Does someone know a better way to handle this problem?