Created
May 6, 2021 13:41
-
-
Save uyorum/be8616c86dd1cdbf9bd06aa7145f1646 to your computer and use it in GitHub Desktop.
Dockerfile for ruby-centos7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:7 as builder | |
RUN yum install -y git make gcc bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel && \ | |
git clone https://github.com/rbenv/ruby-build.git && \ | |
PREFIX=/usr/local ./ruby-build/install.sh | |
ARG RUBY_VERSION | |
ENV RUBY_VERSION=${RUBY_VERSION:-2.7.3} | |
ENV RUBY_DIR=/usr/local/ruby-${RUBY_VERSION} | |
RUN /usr/local/bin/ruby-build ${RUBY_VERSION} ${RUBY_DIR} | |
FROM centos:7 | |
RUN yum install -y openssl libyaml libffi readline zlib gdbm ncurses | |
ARG RUBY_VERSION | |
ENV RUBY_VERSION=${RUBY_VERSION:-2.7.3} | |
ENV RUBY_DIR=/usr/local/ruby-${RUBY_VERSION} | |
COPY --from=builder ${RUBY_DIR} ${RUBY_DIR} | |
ENV GEM_HOME=/tmp/gems | |
VOLUME ${GEM_HOME} | |
ENV PATH=/tmp/gems/bin:${RUBY_DIR}/bin:${PATH} | |
CMD irb |
thank you, this also works for an Amazon Linux 2 base image if you want to use your own codebuild env for example based on https://gallery.ecr.aws/codebuild/amazonlinux2-x86_64-standard 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker build -t ruby-mine:2.7.3 --build-arg RUBY_VERSION=2.7.3 .