I made it work adding a new step that makes sure the right bundler version is used before building. The bundler version is obtained from the last line of the Gemfile.lock.
- run:
name: Configure Bundler
command: |
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
source $BASH_ENV
gem install bundler