We use a Docker image to run CI builds. The Docker image has a system-installed Ruby. The Docker container has the content of gem env
and bundle env
as indicated in the gist linked files:
[root@045ce9939883 code]# which ruby
/usr/local/bin/ruby
[root@045ce9939883 code]# ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
[root@045ce9939883 code]# bundle -v
Bundler version 2.0.2
We ran the following commands in the Docker container to install the gems at ./vendor/bundle
:
bundle config --local path vendor/bundle
bundle install --jobs 5 --retry 3
We then tarred the entire directory, including ./vendor/bundle
so that we can deploy the contents later using capistrano
. On the deployment machines, we first untarred the tar file and then ran the cap deploy
commands.
bundler
on the deployment machines can't seem to locate gems which are built with native extensions in ./vendor/bundle
. It seems to find all the other gems just fine:
[jenkins@tel-web-sob-r01-n01 2.1.10]$ bundle doctor
The following gems are missing
* nokogiri (1.10.9)
* nio4r (2.5.2)
* websocket-driver (0.7.2)
* bindex (0.5.0)
* byebug (9.0.6)
* puma (3.9.1)
* ffi (1.9.18)
Install missing gems with `bundle install
[jenkins@tel-web-sob-r01-n01 2.1.10]$ ls -l ./vendor/bundle/ruby/2.5.0/gems/ | grep nokogiri
drwxr-xr-x 7 jenkins jenkins 157 Jun 22 13:05 nokogiri-1.10.9
The deployment machine's gem env
and bundle env
contents are as linked
What I know so far:
./vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0-static/
. If I rename that directory to 2.5.0
, it works.The Dockerfile
with which we are setting up ruby & bundler is similar to this one.
The machines where we deploy the bundled gems are RHEL machines and install ruby from the software collections repositories.
It seems like the deployment machines ruby is built with the --enable-shared=yes
flag.
We changed our Dockerfile
to configure the ruby build the same way, ./configure --enable-shared=yes
. That solved our issue.