fix the url
[dockerfiles.git] / ruby-2.5.6 / Dockerfile
blob6317e41e0eed5a72b695bd68a1cd427384e22c16
1 # DESCRIPTION:   Ruby 2.5.6 container
2 # AUTHOR:        Ricardson Williams <ricardsonwilliams@gmail.com.br>
3 # COMMENTS:
4 #    Build Ruby 2.5.6 based on Amazon Linux 2 LTS (https://aws.amazon.com/amazon-linux-2/)
6 # USAGE:
7 #    # Download Dockerfile
8 #    wget https://raw.githubusercontent.com/ricardson/dockerfiles/master/ruby-2.5.6/Dockerfile
10 #    # Build ruby image
11 #    docker build -t ruby-2.5.6-amazonlinux .
13 #    # Run the image
14 #    docker run -it ruby-2.5.6-amazonlinux
17 FROM amazonlinux:2 
19 ENV RUBY_MAJOR 2.5
20 ENV RUBY_VERSION 2.5.6
21 ENV RUBYGEMS_VERSION 3.0.3
22 ENV BUNDLER_VERSION 2.0.2
24 RUN \
25      mkdir -p /usr/local/etc \
26      && { \
27           echo 'install: --no-document'; \
28           echo 'update: --no-document'; \
29         } >> /usr/local/etc/gemrc
31 RUN \
32      yum -y groupinstall 'Development Tools' \
33      && yum -y update \
34      && yum -y install \
35      libyaml-devel \
36      openssl \
37      openssl-devel \
38      gdbm-devel \
39      libffi-devel \
40      gmp-devel \
41      readline-devel \
42      wget \
43      && yum clean all \
44      && wget https://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz \
45      && tar xzf ruby-$RUBY_VERSION.tar.gz -C /usr/src \
46      && cd /usr/src/ruby-$RUBY_VERSION \
47      && CFLAGS="-O3 -fPIC -fno-strict-aliasing" ./configure --disable-install-doc --enable-shared --enable-pthread \
48      && make \
49      && make install \
50      && cd / \
51      && rm -rf /usr/src/ruby-$RUBY_VERSION \
52      && rm -rf /ruby-$RUBY_VERSION.tar.gz \
53      && gem update --system "$RUBYGEMS_VERSION" \
54      && gem install bundler --version "$BUNDLER_VERSION" --force \
55      && yum clean all
57 ENV GEM_HOME /usr/local/bundle
58 ENV BUNDLE_PATH="$GEM_HOME" \
59     BUNDLE_BIN="$GEM_HOME/bin" \
60     BUNDLE_SILENCE_ROOT_WARNING=1 \
61     BUNDLE_APP_CONFIG="$GEM_HOME"
62 ENV PATH $BUNDLE_BIN:$PATH
64 RUN \
65      mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
66      && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
68 ###Final Image###
70 FROM amazonlinux:2
72 ENV RUBY_MAJOR 2.5 \
73     RUBY_VERSION 2.5.6 \
74     RUBYGEMS_VERSION 3.0.3 \
75     BUNDLER_VERSION 2.0.2
77 ENV GEM_HOME /usr/local/bundle \
78     BUNDLE_PATH="$GEM_HOME" \
79     BUNDLE_BIN="$GEM_HOME/bin" \
80     BUNDLE_SILENCE_ROOT_WARNING=1 \
81     BUNDLE_APP_CONFIG="$GEM_HOME" \
82     PATH $BUNDLE_BIN:$PATH 
84 RUN \
85     mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
86     && chmod 777 "$GEM_HOME" "$BUNDLE_BIN" \
87     && yum -y install libyaml hostname \
88     && yum clean all \
89     && rm -rf /usr/share/doc/* \
90     && rm -rf /usr/share/info/* \
91     && rm -rf rm -rf /var/cache/yum/* \
92     && cp /etc/skel/.bashrc /root/
94 COPY --from=0 /usr/local/ /usr/local/
96 CMD ["irb"]