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.98k stars 707 forks source link

I want to know which files are being deleted when i using cmd `slim build` #534

Open AlberHwang422 opened 1 year ago

AlberHwang422 commented 1 year ago

I would like to know if there is a way to find out which files are being deleted during compression when using slim build to compress an image.

kcq commented 1 year ago

There's a "long" way to do it with the xray command. You can xray your original image and then you can xray the minified image, which will give you the information about the files in each image. and then you would subtract the file list of the minified image from the file list of your original image (will require a bit of jq magic to get the right data from the slim report json file).

There's an easy way using the Slim SaaS (totally free). You just need to make sure that both images are in a registry the SaaS can connect to. Then you use the "diff"/"compare" image option and you'll get a nice view that show's what's removed and what's still there.

PerseidMeteor commented 3 months ago

Hi, @kcq ,is there any report or log method for me to know what files has been detected when using slim build?

kcq commented 3 months ago

@PerseidMeteor yes, the creport json file in the artifacts directory will give you that info. The console output will show you the artifacts directory where you'll find it. There's also a flag to copy it to your current directory or another location (--copy-meta-artifacts .) where you execute the build command.

You can also get a trace log of data events that's useful too. It's disabled by default. Use the --enable-mondel flag (you'll get a file called model.ndjson in the artifacts directory).