Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Ruby with ruby-install #5356

Merged
merged 2 commits into from
Jul 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ RUN apt-get update \
file \
zlib1g-dev \
liblzma-dev \
libyaml-dev \
libgdbm-dev \
mattt marked this conversation as resolved.
Show resolved Hide resolved
tzdata \
zip \
unzip \
Expand Down Expand Up @@ -65,23 +67,34 @@ RUN if ! getent group "$USER_GID"; then groupadd --gid "$USER_GID" dependabot ;

### RUBY

# Install Ruby, update RubyGems, and install Bundler
ENV BUNDLE_SILENCE_ROOT_WARNING=1
ARG RUBY_VERSION=2.7.5
ARG RUBY_INSTALL_VERSION=0.8.3

ARG RUBYGEMS_SYSTEM_VERSION=3.2.20
# Disable the outdated rubygems installation from being loaded
ENV DEBIAN_DISABLE_RUBYGEMS_INTEGRATION=true

ARG BUNDLER_V1_VERSION=1.17.3
ARG BUNDLER_V2_VERSION=2.3.13
Comment on lines +78 to +79
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this update 🥇

💡 Seeing this change makes me wonder if we could take it further. What do you think about making these ENV variables, then pointing the references in our code (example) to BUNDER_Vx_VERSION? If you're interested, I think a followup PR would be a great fit for the change 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully recall the whole thing from my work on #4973, but I'm pretty sure if BUNDLER_VERSION is used is because RubyGems actually uses that ENV variable to activate the proper Bundler version. So if I understood what you mean, I think it would not work as expected. But if we introduced something like #4973 it wouldn't be needed anyways.

ENV BUNDLE_SILENCE_ROOT_WARNING=1
# Allow gem installs as the dependabot user
ENV BUNDLE_PATH=".bundle" \
BUNDLE_BIN=".bundle/bin"
ENV PATH="$BUNDLE_BIN:$PATH:$BUNDLE_PATH/bin"
RUN apt-add-repository ppa:brightbox/ruby-ng \
&& apt-get update \
&& apt-get install -y --no-install-recommends ruby2.7 ruby2.7-dev \
&& gem update --system 3.2.20 \
&& gem install bundler -v 1.17.3 --no-document \
&& gem install bundler -v 2.3.13 --no-document \
&& rm -rf /var/lib/gems/2.7.0/cache/* \
&& rm -rf /var/lib/apt/lists/*

# Install Ruby, update RubyGems, and install Bundler
RUN mkdir -p /tmp/ruby-install \
&& cd /tmp/ruby-install \
&& curl -fsSL "https://github.com/postmodern/ruby-install/archive/v$RUBY_INSTALL_VERSION.tar.gz" -o ruby-install-$RUBY_INSTALL_VERSION.tar.gz \
mattt marked this conversation as resolved.
Show resolved Hide resolved
&& tar -xzvf ruby-install-$RUBY_INSTALL_VERSION.tar.gz \
&& cd ruby-install-$RUBY_INSTALL_VERSION/ \
&& make \
&& ./bin/ruby-install --system ruby $RUBY_VERSION \
&& gem update --system $RUBYGEMS_SYSTEM_VERSION \
&& gem install bundler -v $BUNDLER_V1_VERSION --no-document \
&& gem install bundler -v $BUNDLER_V2_VERSION --no-document \
&& rm -rf /var/lib/gems/*/cache/* \
&& rm -rf /tmp/ruby-install

### PYTHON

Expand Down