How will this solve the problem? For the default use case, Kamal is a ruby script running with the Ruby version the app uses. This means, with the above change, the builder will pass the correct Ruby version to Docker, overriding the RUBY_VERSION in the Dockerfile.
The way I understand it .ruby_version is a declaration what ruby version is required for this project,
Dockerfile has it’s own mechanism to set up the world, so this requirement is fulfilled.
So I’d rather look for a way for Dockerfile to get version from .ruby_version file, than telling bundler “the required version is whatever version currently available”.
That is what this does. Kamal can only be run from the app directory AFAIK, which means that Gem.ruby_version is the same as the version in the file. Gem.ruby_version also handles apps that are not using .ruby_version.