daily-code
daily-code copied to clipboard
Dockerfile optimised
PR Fixes:
- 1 Optimised the dockerfile for lesser build time. Attaching screenshot of build time with and without optimisation. My explainantion: w/o optimisation if any change in codebase, and rerunning of docker compose watch triggers yarn run install which can be easily cached thereby saving build time.
w/o optimisation
with optimisation (updated dockerfile and a script file(copyalljson.sh) which copies all package.json , yarn.lock files from all directories & subdirectories and pastes into destination equivalent directories within the docker container)
Checklist before requesting a review
- [ ] I have performed a self-review of my code
- [ ] I assure there is no similar/duplicate pull request regarding same issue
Sorry but would this rebuild the copyalljson layer if package.json is actually changed?
Since the script (sh file) hasn't changed, would it forget to re-build the layer and include the old package.json?
Is this standard pattern you saw somewhere?
Sorry but would this rebuild the
copyalljsonlayer ifpackage.jsonis actually changed? Since the script (sh file) hasn't changed, would it forget to re-build the layer and include the old package.json?Is this standard pattern you saw somewhere?
Yes you were right that copyalljson layer wasn't changing and infact the script which executed during image building was actually not copying the parent directory files as docker doesnt allow the script files(using RUN command) during build to access the parent directory filesystems. But, I have update dockerfile to just copy all package.json files and do run yarn install and deleted the script file.