Skip to content

Instantly share code, notes, and snippets.

@gofer
Last active December 14, 2016 06:52
Show Gist options
  • Save gofer/34efc46b343f2309cac13ddf15dbe091 to your computer and use it in GitHub Desktop.
Save gofer/34efc46b343f2309cac13ddf15dbe091 to your computer and use it in GitHub Desktop.
Dockerfile: Ruby on CentOS

How to use

RUBY_VERSION=2.3.3 make
FROM centos:latest
MAINTAINER Gofer (@gofer_ex) <[email protected]>
ARG RUBY_VERSION=2.3.3
RUN yum -y install make git gcc
RUN yum -y install gdbm openssl readline zlib
RUN yum -y install gdbm-devel openssl-devel readline-devel zlib-devel
WORKDIR /usr/local/src
RUN curl -O https://cache.ruby-lang.org/pub/ruby/`echo $RUBY_VERSION | sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1\.\2/g'`/ruby-$RUBY_VERSION.tar.gz && tar xf ruby-$RUBY_VERSION.tar.gz
WORKDIR /usr/local/src/ruby-$RUBY_VERSION
RUN ./configure --prefix=/usr/local --libdir=/usr/local/lib64 --enable-pthread && make && make install
RUN rm -f ruby-$RUBY_VERSION*
RUN yum -y remove gdbm-devel openssl-devel readline-devel zlib-devel
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN gem install bundler
WORKDIR /
ENTRYPOINT /bin/bash
all:
docker build --build-arg RUBY_VERSION=${RUBY_VERSION} -t ruby-centos:${RUBY_VERSION} .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment