Follow-up to https://github.com/GoogleChromeLabs/squoosh/pull/838.
I have no idea what the JS+Wasm diffs in the original PR even represented if they weren't proper rebuilds, but this time I just removed node_modules in all codecs to enforce a proper, clean rebuild for each C++ codec.
(Still think the speed-ups are worth it.)
Use a shared base image with fixed Emscripten version, autotools and optimisation flags for all C++ codecs.
Additionally, move build commands for codecs themselves to Makefile - they're already platform-specific, and Make allows for better caching and parallelisation that custom ad-hoc scripts.
This is essentially same as #777 but for C++.
It's not possible to share them across threads, so in case we decide to use multithreading in the future, it's best to mark them as thread_local right away, even if it's a no-op right now.
- Store Emscripten cache inside node_modules/.em_cache. Docker image ships without LTO libs, so Emscripten has to rebuild stdlibs on every build otherwise.
- Merge webp_enc + webp_dec build scripts. Core libwebp library is same in both cases, so there's no point in storing and building two copies of it.