This is a VERY small mri ruby 2.2.3 image. It uses the Alpine Linux ruby packages, and has bundler
and minimal ruby packages installed.
FROM cybercode/alpine-ruby:2.2
CMD["/mycommand"]
Unlike the Official Ruby Image or tinycore-ruby, it does not create any users or do ONBUILD
magic and the CMD
defaults to irb
.
This image does not contain a compiler, etc. The best way to install C-based gems is to install the compiler chain and any development libraries required, run bundle install and remove the libraries all in one RUN
command. That way the the final image will stay small.
For example, if you are using the pg
and nokogiri
gems:
RUN apk --update add --virtual build_deps \
build-base ruby-dev libc-dev linux-headers \
openssl-dev postgresql-dev libxml2-dev libxslt-dev && \
sudo -iu app bundle config build.nokogiri --use-system-libraries && \
sudo -iu app bundle install --path vendor/bundle && \
apk del build_deps