[font] install native custom fonts for build container to generate og-image with "sharp"

During the build process, we want to render SVGs to PNGs using “sharp”. But sharp requires the linux system to have font libraries installed.

Is there a way to uniformly install font libraries during the build when there’s no admin rights to do apt-get install?

Refs:

Seems like you can use the FONTCONFIG_PATH variable to point to a custom directory. You’d have to make sure the required files exist in your repo though.

This tackles one problem, but I’ve got over a dozen Netlify projects, so tweaking configurations is a pain.

It’d be way handier if I could use apt-get install to install custom fonts, so I’m curious if there’s a smarter approach.

Netlify has team-level environment variables, so you should not need to configure it for every project. However, if there’s some other problem that needs to be handled for each project, then that’s a different discussion.

As for apt install, we won’t be adding that functionality. You can create a build plugin that would fetch the required fonts from somewhere and store it in a specific folder, so you can re-use that plugin for each site without having to repeat your config or something - but that’s just a guess as I don’t know about your workflow to suggest anything else.