The frontend is parameterized with environment variables REACT_APP_BACKEND and REACT_APP_BACKEND_PORT
in frontend/src/helpers/api/axiosInstance.js to support different configurations for different environments.
This works fine for Docker container parameterization in test and development environments, but when building a production image that uses a static server webpack instantiates the variables and eliminates the parameterization.
The goal of this issue is to change to a parameterization of frontend that allows a production image to be built using react build and still allows for the environment variables.
The frontend is parameterized with environment variables
REACT_APP_BACKEND
andREACT_APP_BACKEND_PORT
infrontend/src/helpers/api/axiosInstance.js
to support different configurations for different environments. This works fine for Docker container parameterization in test and development environments, but when building a production image that uses a static server webpack instantiates the variables and eliminates the parameterization.The goal of this issue is to change to a parameterization of frontend that allows a production image to be built using
react build
and still allows for the environment variables.The best strategy seems to be to create a config file that the code uses, but is not mangled by webpack. This post describes the approach: https://developers.redhat.com/blog/2021/03/04/making-environment-variables-accessible-in-front-end-containers/
Resolution of this issue will change the parameterization so that frontend still works in development and test.