docker-node
docker-node copied to clipboard
minor image cleanup
Description
Perform minor image cleanup.
Motivation and Context
Reduce image size by removing temporary/meaningless files.
Testing Details
I've manually rebuilt node:18-bullseye-slim - all works as expected.
Types of changes
- [ ] Documentation
- [ ] Version change (Update, remove or add more Node.js versions)
- [ ] Variant change (Update, remove or add more variants, or versions of variants)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [x] Others (non of above)
Checklist
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING.md document.
- [ ] All new and existing tests passed.
Relates to #1326.
This seems like a more slim version of https://github.com/nodejs/docker-node/pull/1283 which is fine. There was discussion of the value of v8-compile-cache there too.
Image may be further reduced with following script:
find /usr/local/lib/node_modules/ -name 'README*' -type f -exec rm -f '{}' +
find /usr/local/lib/node_modules/ -name 'CHANGELOG*' -type f -exec rm -f '{}' +
find /usr/local/lib/node_modules/ -path '*/bin/*.cmd' -type f -exec rm -f '{}' +
find /usr/local/lib/node_modules/ -path '*/test*/*' -type f -exec rm -f '{}' +
find /usr/local/lib/node_modules/ -type d | sort -V | while read -r d ; do
[ -d "$d" ] || continue
find "$d/" ! -type d -printf . -quit | grep -Fq . || rm -rf "$d"
done
But I'm not sure does it works with Alpine (i.e. find).
How much was the image size reduced by this?
Less than 1 MiB.
Hey @rockdrilla,
Thanks for your contribution, and I am sorry for the late review. Are you still interested in revising it to get it merged? We need to modify the Dockerfile templates first and then generate the Dockerfiles with changes automatically.
Let me know if you want my help ;)
Hi @PeterDaveHello, I'm still interested in this PR but I may late to respond too. :)
Thanks. Let me know if you have some spare time to resolve the conflicts, or maybe just getting started from the current main branch will be easier, as it's been a while.