ledermann/docker-rails-base

Bundler v2 missing

joshpc opened this issue · 3 comments

I tried using your project for a fresh rails project (thanks for this! this is great) but wasn't able to get it running out of the box.

Using a brand new rails project, and using the basic Dockerfile:

FROM ledermann/rails-base-builder:latest AS Builder
FROM ledermann/rails-base-final:latest
USER app
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]

When running a docker build, I was getting the following error:

/usr/local/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /app/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`
	from /usr/local/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
	from /usr/local/bin/bundle:23:in `<main>'

It looks like the base containers don't actually have bundler so I needed to add RUN gem install bundler before the bundle config call here: https://github.com/ledermann/docker-rails-base/blob/master/Builder/Dockerfile#L22


Am I missing a setup step for local development / is there a reason why install bundler isn't added? (do you expect CI to add it?)

The Bundler gem is included in the image, but it is v1.17.2, not v2.

$ docker run ledermann/rails-base-builder bundle -v
Bundler version 1.17.2

This is because the official Ruby Docker images for Ruby 2.6 contain this version. With Ruby 2.7, Bundler v2 is installed. I hope to update this repo to Ruby 2.7 and Bundler v2 in the near future.

To fix your app now, you can downgrade your Bundler version to v1.17.2 in your Gemfile.lock or you can fork this repo and build your own base image.

Closed by 25c55e3