Update README.md
[dockerfiles.git] / ruby-3.0.2 / Dockerfile
blobdbb63887a3c019ae702701d255f0d9f9439a88b6
1 # DESCRIPTION:   Ruby 3.0.2 container
2 # AUTHOR:        https://github.com/r1w1s1
3 # COMMENTS:
4 #    Build Ruby 3.0.2 based on Ubuntu 20.04
6 # USAGE:
7 #    # Download Dockerfile
8 #    wget https://raw.githubusercontent.com/r1w1s1/dockerfiles/master/ruby-3.0.2/Dockerfile
10 #    # Build ruby image
11 #    docker build -t ruby-3.0.2-ubuntu:20.04 .
13 #    # Run the image
14 #    docker run -it ruby-3.0.2-ubuntu:20.04
17 FROM ubuntu:20.04
19 ENV RUBY_MAJOR 3.0
20 ENV RUBY_VERSION 3.0.2
21 ENV RUBYGEMS_VERSION 3.2.29
22 ENV BUNDLER_VERSION 2.2.29
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     apt-get update \
33     && DEBIAN_FRONTEND=noninteractive \
34         apt-get install -y --no-install-recommends \
35     ca-certificates \
36         autoconf \
37     automake \
38         bzip2 \
39         dpkg-dev \
40         file \
41         g++ \
42         gcc \
43         imagemagick \
44         libbz2-dev \
45         libc6-dev \
46         libcurl4-openssl-dev \
47         libdb-dev \
48         libevent-dev \
49         libffi-dev \
50         libgdbm-dev \
51         libglib2.0-dev \
52         libgmp-dev \
53         libjpeg-dev \
54         libkrb5-dev \
55         liblzma-dev \
56         libmagickcore-dev \
57         libmagickwand-dev \
58         libmaxminddb-dev \
59         libncurses5-dev \
60         libncursesw5-dev \
61         libpng-dev \
62         libpq-dev \
63         libreadline-dev \
64         libsqlite3-dev \
65         libssl-dev \
66         libtool \
67         libwebp-dev \
68         libxml2-dev \
69         libxslt-dev \
70         libyaml-dev \
71         make \
72         patch \
73         unzip \
74         xz-utils \
75         zlib1g-dev \
76     wget \
77     && wget https://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz \
78     && tar xzf ruby-$RUBY_VERSION.tar.gz -C /usr/src \
79     && cd /usr/src/ruby-$RUBY_VERSION \
80     && CFLAGS="-O3 -fPIC -fno-strict-aliasing" ./configure --disable-install-doc --enable-shared --enable-pthread \
81     && make \
82     && make install \
83     && cd / \
84     && rm -rf /usr/src/ruby-$RUBY_VERSION \
85     && rm -rf /ruby-$RUBY_VERSION.tar.gz \
86     && gem update --system "$RUBYGEMS_VERSION" \
87     && gem install bundler --version "$BUNDLER_VERSION" --force \
88     && apt-get clean
90 ENV GEM_HOME /usr/local/bundle
91 ENV BUNDLE_PATH="$GEM_HOME" \
92     BUNDLE_BIN="$GEM_HOME/bin" \
93     BUNDLE_SILENCE_ROOT_WARNING=1 \
94     BUNDLE_APP_CONFIG="$GEM_HOME"
95 ENV PATH $BUNDLE_BIN:$PATH
97 RUN \
98     mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
99     && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
101 FROM ubuntu:20.04
103 ENV GEM_HOME /usr/local/bundle
104 ENV BUNDLE_PATH="$GEM_HOME" \
105     BUNDLE_BIN="$GEM_HOME/bin" \
106     BUNDLE_SILENCE_ROOT_WARNING=1 \
107     BUNDLE_APP_CONFIG="$GEM_HOME"
108 ENV PATH=$BUNDLE_BIN:$PATH
110 RUN \
111     mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
112     && chmod 777 "$GEM_HOME" "$BUNDLE_BIN" \
113     && apt-get update \
114     && apt-get install -y libyaml-0.2 \
115     && rm -rf /usr/share/doc/* \
116     && rm -rf /usr/share/info/* \
117     && rm -rf /var/cache/apt/archives/*
119 COPY --from=0 /usr/local/ /usr/local/
121 CMD ["irb"]