1 # DESCRIPTION: Ruby 3.0.2 container
2 # AUTHOR: https://github.com/r1w1s1
4 # Build Ruby 3.0.2 based on Ubuntu 20.04
7 # # Download Dockerfile
8 # wget https://raw.githubusercontent.com/r1w1s1/dockerfiles/master/ruby-3.0.2/Dockerfile
11 # docker build -t ruby-3.0.2-ubuntu:20.04 .
14 # docker run -it ruby-3.0.2-ubuntu:20.04
20 ENV RUBY_VERSION 3.0.2
21 ENV RUBYGEMS_VERSION 3.2.29
22 ENV BUNDLER_VERSION 2.2.29
25 mkdir -p /usr/local/etc \
27 echo 'install: --no-document'; \
28 echo 'update: --no-document'; \
29 } >> /usr/local/etc/gemrc
33 && DEBIAN_FRONTEND=noninteractive \
34 apt-get install -y --no-install-recommends \
46 libcurl4-openssl-dev \
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 \
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 \
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
98 mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
99 && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
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
111 mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
112 && chmod 777 "$GEM_HOME" "$BUNDLE_BIN" \
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/