-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Distributing ruby apps is currently more difficult than it needs to be.
It usually involves a set of instructions telling the end-user how to get the right ruby version, to regenerate or use an existing Gemfile.lock, maybe deal with uninstallable gems (because of dependency issues), etc. The alternative is dealing with Docker, but that comes with its own difficulties.
It would reduce a lot of friction and make ruby more attractive if the tooling enabled compiling and distributing a single-file static binary, or something as close to it as possible.
There's been projects in the past that tried to solve this, like:
- ruby-packer (or a more recent fork)
- Traveling Ruby
- ruby-invfs
- wasi-vfs
- … (probably more)
These solutions usually end up slightly outdated, and would benefit from a bundler integrated solution.
I think it's important to distinguish different levels of "packing".
- Just the gem dependencies (ruby)
Basically storing everything in the bundle path in a zip, SquashFS or DwarFS read-only image, and ensuringload,require, etc do the right thing. Maybe using a ruby shebang argument, abundler/inline-like statement, and/or something like a__END__hack to actually inline the image. - All (file) resources
This would require implementing ruby'sFileAPI to be able to read the bundle image. Useful for things like assets and other ancillary files. - All (file) resources accessible through gem extensions
This would require linking some C libc/vfs overrides, which would probably make things like bootsnap work. I believe wasi-vfs takes a similar approach. - Everything including the ruby interpreter
Even better if we could statically compile the whole thing.
I believe an official bundler-supported solution for even just 1. or 2. would be a big help.
Maybe the solution is just to rely on ruby.wasm, ruvy and wasi-vfs, even if depending on wasm would limit the applicability. But even then it'd still be nice to ensure the tooling around bundler would make it very easy to use.