Problem: The ruby version currently is duplicated at least once in a new Rails app that uses Kamal. “.ruby-version” and “Dockerfile”.
Proposal: Have the “deploy.yml.tt” generator have the following:
builder:
...
args:
RUBY_VERSION: <%= "\<%= Gem.ruby_version %>" %>
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.