Good question! In a case like that you'll have to be a little more aggressive about copying libraries from the build container.
I'm not super familiar with Ruby, but I think I found a decent example at: https://github.com/unasuke/distroless-ruby
I'm not super familiar with Ruby, but I think I found a decent example at: https://github.com/unasuke/distroless-ruby