wkhtmltopdf_binary_gem icon indicating copy to clipboard operation
wkhtmltopdf_binary_gem copied to clipboard

Smaller gems

Open tabfugnic opened this issue 9 months ago • 0 comments

Hello!

I was running into an issue recently where my heroku instance was failing to build due to too large of a slug.

I looked into wkhtmltopdf_heroku, but wasn't keen on setting variables for production vs other environments.

I opted to take the different approach of limiting the files per platform.

This is by no means a perfect solution, but there is really no reason to have a bunch of x86 or arm64 binaries when all you use is x86_64.

I took a few liberties in renaming files.

There is a bit more testing to do.

Use more consistent naming for files

Rubygems(and even rbconfig) use standard architecture naming. Instead of going against the grain ensure that the architecture matching that naming for the most part.

Small gotcha is that arch64, aarch64, arm64 to be the same architecture.

Build gems based on platform

The previous gem size peaked at over 250MB by providing an unnecessary amount of unused binaries.

Using the os host(kernel name) and the architecture, separate out individual platform gemspecs provide a subset of the needed files.

This change is NOT perfect. It can only limit platforms by kernel and architecture. It does not take the distribution of Linux into account, so it will still provide an unnecessary number of files, but fewer.

Minor updates:

  • Set minimum ruby version
  • Set versions for development dependencies

tabfugnic avatar May 29 '24 04:05 tabfugnic