Sign inSign up

andrius/alpine-ruby

By andrius

•Updated 2 months ago

The smallest Docker image with Ruby

Image
3

100K+

andrius/alpine-ruby repository overview

⁠Ruby Docker image

The smallest Docker image with Ruby, is based on Alpine Linux image, which is only a 5MB image. It does only have ruby and bundler (except image with tiny tag).

Total size of this image is only:

⁠Support

This is minimal image with only necessary packages, to run your app in production. Image build by using only official applications from Alpine linux, and supported AS IS.

⁠Tags

Tags referring Alpine ruby version, not ruby version.

glibc-latest is an version that contains glibc to enable proprietary projects compiled against glibc and based on latest frolvlad/alpine-glibc⁠.

⁠Usage Example

Check ruby version:

docker run -ti --rm andrius/alpine-ruby:latest ruby -v

Hello, world:

docker run -ti --rm andrius/alpine-ruby ruby -e "puts 'Hello, world!'"

Once you have run this command you will get printed 'Hello World' from Ruby!

⁠Development packages

Sometimes you could need to install various gems, where development packages is mandatory.

Usually it's enough to install following packages:

apk add --update ruby-dev build-base \
  libxml2-dev libxslt-dev pcre-dev libffi-dev \
  mariadb-dev postgresql-dev

⁠About nokogiri installation

In order to install nokogiri, you could use alpine's version:

apk add --update ruby-nokogiri

However you could need specific version or want to follow version from Gemfile, you could install it:

# installing *dev stuff
apk add --update ruby-dev build-base

bundle install
# or you could install gem directly
gem install nokogiri -- --use-system-libraries

# removing *dev stuff
apk del ruby-dev build-base

Tag summary

Content type

Image

Digest

sha256:7639dd3ca…

Size

12.7 MB

Last updated

over 2 years ago

docker pull andrius/alpine-ruby