Search code examples
rubydockerrubygemsbundler

How do I search the gem with specific version and platform


I encountered problem that the sorbet-static:0.5.10346-x86_64-linux couldn't install with either bundle install and gem install sorbet-static:0.5.10346 --platform x86_64-linux in ruby:2.5.1 x86_64 docker container.

So I'm want to check availability of the sorbet-static gem with specific version and platform in a docker container.

Problem part

FROM ruby:2.5.1
# To be able to install old packages from archive.
ADD ./docker/web/sources.list /etc/apt/sources.list
RUN apt-get update -qq && apt-get install -y build-essential nodejs && rm -rf /var/lib/apt/lists/*
ENV APP_PATH /opt/app
WORKDIR $APP_PATH
ADD Gemfile $APP_PATH
ADD Gemfile.lock $APP_PATH
ADD gems $APP_PATH/gems
RUN bundle install --jobs `expr $(cat /proc/cpuinfo | grep -c "cpu cores") - 1` --retry 3
Fetching gem metadata from https://rubygems.org/........
Could not find sorbet-static-0.5.10346-x86_64-linux in any of the sources

I have tried below commands, however results are not useful.

I got the latest version.

gem search sorbet-static

I got results that is too many combination of versions and platforms.

gem search sorbet-static --all

Solution

  • 🗎 Dockerfile

    FROM ruby:2.5.1
    
    RUN echo "deb http://archive.debian.org/debian/ stretch main contrib non-free" > /etc/apt/sources.list && \
        echo "deb-src http://archive.debian.org/debian/ stretch main contrib non-free" >> /etc/apt/sources.list
    
    RUN apt-get update -qq && \
        apt-get install -y build-essential nodejs && \
        rm -rf /var/lib/apt/lists/*
    
    ADD Gemfile .
    
    RUN bundle install --jobs `expr $(cat /proc/cpuinfo | grep -c "cpu cores") - 1` --retry 3
    

    🗎 Gemfile

    source 'https://rubygems.org'
    
    gem 'sorbet-static', '0.5.10346'
    

    Screenshot below confirms that the version you require has been installed.

    enter image description here