-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic PUBLIC_URL #27
Comments
Hey, thanks for the idea. Just to be clear, it seems that your making |
No, this makes CRA's |
@andrewmclagan I think you misunderstood his solution. Yes, he FIRST replaces |
This guy gets it. 💯 @RobertHeim |
I'm testing the waters for interest here. I worked up a solution for
PUBLIC_URL
, though I'm not sure if it's right for everyone. I'll discuss it, then see the sampleDockerfile
at the end.This solution has two special steps.
PUBLIC_URL
to something I can find later, in my case{{base_url}}
.entrypoint.sh
to find and replace that variable with the runtime environment.This solution does have limitations, though solvable.
$REACT_APP_BASE_URL
across container restart has no effect, because the files are already written.sed
command to create.bak
files and there could be an attempt to restore any.bak
files on boot, anticipating a potential need to find-and-replace again.If there's interest in making this part of
react-env
, I can whip up a pull request. I expect all the dev work would be isolated to theentrypoint.sh
, and of course there'd be documentation updates.In case it's not clear, my
RUN
command:sed
commandfind
command intoentrypoint.sh
sed
command on every file in/var/www
{{base_url}}
with the value of$REACT_APP_BASE_URL
.Fun right? 😀
BTW, I do not see this as a breaking change. It is fully opt-in. For my containers, the
$REACT_APP_BASE_URL
is commonly undefined in dev.The text was updated successfully, but these errors were encountered: