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

minor image cleanup #1874

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

rockdrilla
Copy link

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)
  • Others (non of above)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • All new and existing tests passed.

@rockdrilla
Copy link
Author

Relates to #1326.

Signed-off-by: Konstantin Demin <[email protected]>
@ttshivers
Copy link
Member

This seems like a more slim version of #1283 which is fine.
There was discussion of the value of v8-compile-cache there too.

@rockdrilla
Copy link
Author

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).

@ttshivers
Copy link
Member

How much was the image size reduced by this?

@rockdrilla
Copy link
Author

Less than 1 MiB.

@PeterDaveHello
Copy link
Member

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 ;)

@rockdrilla
Copy link
Author

Hi @PeterDaveHello, I'm still interested in this PR but I may late to respond too. :)

@PeterDaveHello
Copy link
Member

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.

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

Successfully merging this pull request may close these issues.

3 participants