A recent dependency change in the ruby alpine and slim images causes bundler to fail because yaml dev dependencies are no longer there. While it hasn't happened yet, it looks like the change is going to be reverted until the next minor ruby bump.
docker-library/ruby#497 (comment)
We will definitely need the yaml dev dependencies but possibly also others. I also don't know if they can be build only libraries or need to make it to the final image.