rake-compiler / rake-compiler-dock

Easy to use and reliable cross compiler environment for building Windows, Linux, Mac and JRuby binary gems.
MIT License
77 stars 30 forks source link

Include JRuby in the docker image #21

Closed pitr-ch closed 5 years ago

pitr-ch commented 6 years ago

First of all, thanks for the awesome tool!

I maintain concurrent-ruby gem and I need to build java extensions as well as C extensions. I would like to run just one task in the docker to produce all the packages I need for a release, however at the moment JRuby is missing and I cannot compile java extensions. Please consider adding it to the image.

larskanis commented 6 years ago

Sorry for not responding earlier - was on vacation last week...

JRuby is usually quite simple to install on all platforms, so that I originally focused on MRI for Windows only. Now that we support Linux targets as well, and given that the docker image got bigger and bigger with each release, it's a valid question to include JRuby as well.

I don't have much experience with JRuby. Is it enough to just include the latest version 9.x? Do we need Oracle java or is OpenJDK enough?

There's almost nothing we can share between MRI and JRuby in terms of libraries or build environment. Therefore I wonder whether it's a better idea to use a second docker image specific for JRuby. This could be switchable by a parameter and would safe a lot of download size, if only one of both is required.

sodabrew commented 6 years ago

I always build jruby gems on my host system, and have a cheat-sheet of incantations handy. As it sometimes is a pain to get the right JDK set up on new Mac OS releases, just getting it into a docker file at all would be useful.

While there is not much reusability between native code builds for Unix and Windows and Java, abstracting this at the top level with rake commands to make it easier to cut a release would be welcomed imho.

pitr-ch commented 6 years ago

Hi thanks for your replies. There are definitely other solutions. The advantage of having it in one image is that all build rake tasks can run in that image easily without running stuff on different machines (including the host). I got it working with a following commands executed in the image before the build task:

sudo apt-get update
sudo apt-get install -y openjdk-8-jdk-headless
sudo -u rvm bash -ic 'rvm install jruby-9.1.13.0'
export JRUBY_HOME=/usr/local/rvm/rubies/jruby-9.1.13.0

Of course that is downloaded/installed/compiled each time when the gem is build, which is quite non-optimal. Maybe it can help you to see what would be needed to be added to the Dockerfile so it's executed only once during the image build?

larskanis commented 5 years ago

This is implemented in rake-compiler-dock-0.7.0. JRuby is shipped by a dedicated JRuby image, so that the MRI image isn't blown up even more. See the README how it can be used.

I hope that works for you, but if not, don't hesitate to give me a hint.

pitr-ch commented 5 years ago

Awesome! I'll give it a try. Thanks.