Не удалось установить Bundler в образе Ruby Docker - PullRequest
0 голосов
/ 31 января 2019

У меня очень старый проект, который я поддерживаю.Я использую docker для сборки и все работало до последней попытки.

Это мой Dockerfile:

FROM ruby:2.1

# Install apt based dependencies required to run Rails as 
# well as RubyGems. As the Ruby image itself is based on a 
# Debian image, we use apt-get to install those.
RUN apt-get update && apt-get install -y \ 
    git \
    ghostscript \
    libgs-dev \
    build-essential \ 
    libmysqlclient-dev \
    locales \
    nodejs

# Use en_US.UTF-8 as our locale
RUN locale-gen en_US.UTF-8 
ENV LANG en_US.UTF-8 
ENV LANGUAGE en_US:en 
ENV LC_ALL en_US.UTF-8

# Configure the main working directory. This is the base 
# directory used in any further RUN, COPY, and ENTRYPOINT 
# commands.
RUN mkdir -p /app 
WORKDIR /app

# Copy the Gemfile as well as the Gemfile.lock and install 
# the RubyGems. This is a separate step so the dependencies 
# will be cached unless changes to one of those two files 
# are made.
COPY Gemfile Gemfile.lock ./ 
COPY vendor/oohlalog_gem ./vendor/oohlalog_gem
RUN gem install bundler && bundle install

# Copy the main application.
COPY . ./

# Expose port 3000 to the Docker host, so we can access it 
# from the outside.
EXPOSE 3000

# Configure an entry point, so we don't need to specify 
# "bundle exec" for each of our commands.
ENTRYPOINT ["bundle", "exec"]

# The main command to run when the container starts. Also 
# tell the Rails dev server to bind to all interfaces by 
# default.
CMD ["rails", "server", "-b", "0.0.0.0"]

Когда я пытаюсь запустить:

docker build . -t my_image

Я получаю:

Шаг11: RUN gem install bundler && bundle install
---> Запуск в 7f8e7442b423 ОШИБКА: Ошибка при установке пакета:
для пакета требуется версия Ruby> = 2.3.0.

Не знаюне знаю, как это исправить.

Ответы [ 2 ]

0 голосов
/ 31 января 2019

Это результат выпуска новой версии Bundler 2.0.0, которая произошла 3 января 2019 года. Согласно GitHub проблема это желаемое поведение.

Поскольку это старый и более не поддерживаемый проект, лучшим вариантом для вас будет использование более старого пакета.

Вы можете изменить строку из вашего Dockerfile:

RUN gem install bundler && bundle install

на следующее:

RUN gem install bundler -v '$OLD_BUNDLER_VERSION' && bundle install

, где $ OLD_BUNDLER_VERSION должен быть установлен на последнюю известную рабочую версию, т.е.1.16.1

0 голосов
/ 31 января 2019

Попробуйте более новую версию изображения ruby ​​в качестве базы.Вы используете 2.1 (FROM ruby:2.1), но вам нужна версия ruby ​​2.3.0

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...