JoeNyland / docker-ruby-alpine-libv8

Alpine Linux based Ruby Docker image with libv8 gem
https://hub.docker.com/r/joenyland/ruby-alpine-libv8/
9 stars 7 forks source link
alpine docker execjs libv8 musl

docker-ruby-alpine-libv8 Docker Build Status

This image is based on the official Ruby image for Alpine Linux. It contains the libv8 gem installed with a V8 engine that's built against the musl C library that Alpine Linux uses.

One can, of course, just install NodeJS in Alpine Linux and ExecJS will just use that. If you'd prefer not to use NodeJS, then you can use this image to base your app on.

Example

Here's what happens with the normal Alpine based Ruby image:

docker run -it --rm ruby:alpine sh
apk add build-base
gem install therubyracer
irb(main):001:0> require 'v8'
LoadError: Error relocating /usr/local/bundle/gems/therubyracer-0.12.3/lib/v8/init.so: __vfprintf_chk: symbol not found - /usr/local/bundle/gems/therubyracer-0.12.3/lib/v8/init.so

And here's it working with this image:

docker run -it --rm joenyland/ruby-alpine-libv8
apk add build-base
gem install therubyracer
irb(main):001:0> require 'v8'
=> true
irb(main):002:0> V8::Context.new.eval 5 * 9
=> 45

Contributing