jruby / docker-jruby

MIT License
18 stars 27 forks source link

BUNDLE_PATH is set to a different location than rubygems #65

Closed mount986 closed 4 years ago

mount986 commented 4 years ago

I use Rubymine, and in order to use a docker image as a remote interpreter, it opens a container and runs the command jgem list to determine what gems are included. Because gems that are installed using bundler are in a different location, they are not included. This wouldn't be a huge deal, except for the fact that Rspec isn't include as a default gem (see #64 ). I have rspec in my Gemfile, but the IDE still can't see it. I have to specifically add jgem install rspec to the Dockerfile to get it to work.

Is there a reason that BUNDLE_PATH needs to be set to a separate location? The default bundler behavior if this isn't set is to use the rubygems path, and to but the executables in the jruby installation path. This works great for most installations I've had in the past.

Note I have also created a ticket for Rubymine to search the BUNDLE_PATH location for gems as well. https://youtrack.jetbrains.com/issue/RUBY-26392

cpuguy83 commented 4 years ago

The ruby configuration is taken from the MRI based image at github.com/docker-library/ruby. The reason for it is to not have a .bundle for every app.

https://github.com/cpuguy83/docker-jruby/blob/2701333ca7d7bf910be70fb103bdaadcdd874979/9000/jre/Dockerfile#L24-L25

Note that BUNDLE_PATH is set to $GEM_HOME, which as I recall should be what rubygems uses. But maybe we need to make sure that GEM_PATH includes our custom $GEM_HOME?

/cc @tianon

tianon commented 4 years ago

I know there's definitely been a lot of discussion/revision on these settings over in https://github.com/docker-library/ruby from/with the larger Ruby community (https://github.com/docker-library/ruby/pull/306, https://github.com/docker-library/ruby/pull/209, for example).

Maybe we need to resync with https://github.com/docker-library/ruby/blob/a6b23d587aa4ce804f69b40d3fb48bc27c4a39db/Dockerfile-debian.template#L83-L89 ?

deivid-rodriguez commented 4 years ago

I just found this. Yes, resyncing the images with docker-library/ruby should do the trick since the final decision was to preserve the default behaviour of bundler, which is what's being requested here.

mount986 commented 4 years ago

just wondering if there's any ETA on this? looking to get my organization on-boarded with executing tests via docker.

deivid-rodriguez commented 4 years ago

I think if you create a PR it will be more likely that this happens sooner.

deivid-rodriguez commented 4 years ago

It would be a matter of porting https://github.com/docker-library/ruby/pull/306 to this repo.

cpuguy83 commented 4 years ago

Happy to take a pr.