Skip to content

Bundler paths possibly breaking rails console #72

Closed
@joearasin

Description

@joearasin

This is possibly a duplicate of #53 and #51 --

When I attempt to run a rails console based off of a relatively straightforward dockerfile:

FROM ruby:2.2

# install packages
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs

# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY Gemfile /usr/src/app/
COPY Gemfile.lock /usr/src/app/

RUN bundle install

COPY . /usr/src/app

CMD bundle exec rails s Puma -p 32000 -b '0.0.0.0'

I receive an Error:

/usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
    from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/bundle/gems/spring-1.3.6/lib/spring/commands.rb:33:in `<module:Spring>'
    from /usr/local/bundle/gems/spring-1.3.6/lib/spring/commands.rb:4:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/bundle/gems/spring-1.3.6/lib/spring/application.rb:77:in `preload'
    from /usr/local/bundle/gems/spring-1.3.6/lib/spring/application.rb:143:in `serve'
    from /usr/local/bundle/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
    from /usr/local/bundle/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
    from /usr/local/bundle/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
    from /usr/local/bundle/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'                                                                                                                                 

If I insert a gem install bundler in the dockerfile before executing bundle install, I'm in the clear.

But this feels a bit wrong -- I'm not sure if there's a path variable that needs to be set so the system bundler install can then be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions