pacificclimate / station-data-portal

Data portal for station data (e.g., BC Station Data, a.k.a. PCDS; Yukon-NWT Station Data); React app
0 stars 0 forks source link

Docker image builds itself when starting #182

Open Nospamas opened 6 months ago

Nospamas commented 6 months ago

Outlining the problem:

Why this is bad:

Reasons for the problem (I think): Create react app requires you to provide environment variables at build time. As such, as there are two different versions of this app (4 if you count dev/prod split) those variables need to be provided at runtime. Because of the CRA limitation, we currently have to build the javascript during initial runtime in order to provide those variables, resulting in the above behaviour.

Potential solutions: Fixing it isn't trivial, but these might be potential routes:

Nospamas commented 4 months ago

a more bash based solution: https://medium.com/@hasniarif/how-to-handle-runtime-environment-variables-with-react-ec809cb07831