slimtoolkit / slim

Slim(toolkit): Don't change anything in your container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)
Apache License 2.0
18.78k stars 700 forks source link

How do I know what the slim tool did to the original image? #671

Closed HJX-zhanS closed 2 months ago

HJX-zhanS commented 2 months ago

When I used xray to analyze before and after slimming, I can extract the files that only existed in the image before slimming from their respective slim.report.json files.

However, the total size of these files is not equal to the image size before slimming minus the image size after slimming. Why?

Can somebody help me?

Thanks

kcq commented 2 months ago

You get additional files that get generated when the dynamic analysis is done with the temporary container. Some of the original files also get mutated at runtime. You can disable this behavior by setting --include-new to false. There's also the --preserve-path flag that can help you keep the original version of the target file you specify with the flag.