[🤔] Proposal: Download Compiled Assets on Local Install instead of Compiling them Locally
See original GitHub issueI’m marking this as a proposal as I’d be very interested in what you all think about this and to see if there are other downsides to this then the ones listed below.
Description
The local Juice Shop install currently takes a long amount of time. This time is basically spent on two tasks:
- Downloading Dependencies via npm (for both backend & frontend)
- Compiling the Angular frontend
Solution ideas
Instead of compiling assets locally, Juice Shop could download the compiled frontend assets, as these are identical for every install of a specific Juice Shop version, even when a customized config.
To download the assets every (future) JuiceShop release could have these assets attached as a Zip on the GitHub Release.
The download could happen at two possible steps:
postInstall
. Basically where the compilation is happening now, using a postInstall npm hook to download the Zip and unzipping it to thefrontend/dist/
folder.- On startup, similar to other steps, e.g.
lib/customizeApplication.js
This download should only happen if the frontend/dist/
folder doesn’t already contain the compiled assets for the current juice-shop version. If it contains the assets for a different version, frontend/dist/
should be deleted and replaced with the assets matching the released version.
🐳 How about Docker?
The docker image build should be updated to still compile the assets locally, so that the container don’t need to download the assets on startup.
🔙 Backwards Compatibility
This should not interfere with older versions as these would still compile their assets locally.
👍 Benefits
- Allows to completely skip the frontend npm install for most users (Saves a ~500MB download of npm dependencies, compared to the ~30MB of compiled assets)
- Allows to skip resource intensive frontend compilation
- Would enable to also improve the npm install for the server dependencies as they could more easily download only the production dependencies
- All in all this should improve the "git clone to running Juice Shop time dramatically by skipping / optimizing the most time consuming parts.
👎 Downsides
- Local install isn’t “ready” to start developing, as they are missing development dependencies
- Requires additional CI config to compile and publish assets to GitHub Releases
- What to do when asset download is failing?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Okay nice 👍 I’ll try to prototype this in my personal Juice Shop fork.
This thread has been automatically locked because it has not had recent activity after it was closed. 🔒 Please open a new issue for regressions or related bugs.