iron-io/dockers

Installing the gem mysql2 0.4.4

Closed this issue · 1 comments

When I executed this command.

docker run --rm -v "$PWD":/worker -w /worker iron/ruby:dev bundle install --standalone --clean

I got that code.

`Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby -r ./siteconf20160511-1-1hecfl5.rb extconf.rb

checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no


mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib

extconf failed, exit code 1

Gem files will remain installed in /worker/bundle/ruby/2.2.0/gems/mysql2-0.4.4 for inspection.
Results logged to /worker/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0/mysql2-0.4.4/gem_make.out
An error occurred while installing mysql2 (0.4.4), and Bundler cannot continue.
Make sure that gem install mysql2 -v '0.4.4' succeeds before bundling.
`

You'll probably need to add the mysql libs to your image. Make a new Dockerfile and add the mysqllibs.

Try this:

FROM iron/ruby:dev
RUN apk add ruby-mysql2

Then docker build -t myrubyimage . and then use that image in your bundle install command, see if that works.