Skip to content
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

Docker image builds itself when starting #182

Open
Nospamas opened this issue Mar 1, 2024 · 1 comment
Open

Docker image builds itself when starting #182

Nospamas opened this issue Mar 1, 2024 · 1 comment

Comments

@Nospamas
Copy link
Contributor

Nospamas commented Mar 1, 2024

Outlining the problem:

  • When pulling the image the image takes the full javascript source from the repostory
  • When deployed to a server, the javascript must be built before the site can be served
  • This results in a long delay before the container is usable after starting

Why this is bad:

  • I think this is better explained by better writers here: https://12factor.net/disposability
  • Building requires a very large spike in resource usage (Multi gigabytes of ram, CPU spike) compared to its normal running scenario. This makes it harder to provide good resource limits if we migrate to k8s

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant