linuxdeploy / linuxdeploy-plugin-conda

Python plugin for linuxdeploy. Sets up miniconda in an AppDir and installs user specified packages.
MIT License
29 stars 13 forks source link

Possible strategy for "thinning" AppImages #23

Open probonopd opened 5 years ago

probonopd commented 5 years ago

Here is one possible strategy for "thinning" AppImages so that they contain only the subset of Python and other files that is actually needed. Using this, I could reduce the size of TruFont from approximately 120 MB to just one third, under 40 MB.

mkdir squashfs-root
sudo mount -t tmpfs tmpfs squashfs-root/ -o strictatime,nodiratime 
./TruFont-*-x86_64.AppImage --appimage-extract
touch test
./squashfs-root/AppRun
# Kill
find squashfs-root/ -mindepth 3 -not -anewer test -not -path '*/share/icons/*' -not -path '*/share/applications/*' -not -path '*/share/metainfo/*' -delete || true
find squashfs-root/ -type d -empty -delete
./squashfs-root/AppRun 
appimagetool ./squashfs-root

The downside is that you need to manually "exercise" all parts of the application, so that the mechanism detects all files that are actually needed.

TheAssassin commented 5 years ago

Doesn't seem safe at all. And requires running an AppImage, which isn't possible during a plugin run. I think that's something to put in the docs as "potential optimization", but then again, this doesn't seem like something you'd want to tell people to use and then use up hours to support afterwards...

The plugin has actually received some safe performance improvements recently. Simple CLI AppImages like appimagelint have a size of 25 MiB, which is very good given we bundle an entire Python interpreter environment plus the software and a few dependencies.