bundle install in dockerfile

17 Views Asked by At

I tried many options to install bundle but nothing helped. Here is my dockerfile:

ERROR: failed to solve: process "/bin/sh -c gem bundle install" did not complete successfully: exit code: 1

FROM gitlab.akb-it.ru:4567/academy/devops/ruby-image:3.2.2-ubuntu-22.04 as builder
WORKDIR /usr/src/app

RUN apt-get update && apt-get install -y \
    git curl autoconf bison build-essential \
    libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libpq-dev libncurses5-dev \
    apt-utils libffi-dev libgdbm6 libgdbm-dev libdb-dev gcc g++ make 

COPY Gemfile Gemfile.lock ./

RUN gem bundle install

#########################################
#                                       #
#########################################

FROM gitlab.akb-it.ru:4567/academy/devops/ruby-image:3.2.2-ubuntu-22.04

ENV TZ=Europe/Moscow
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y libyaml-dev zlib1g-dev libpq-dev libyaml-dev libreadline6-dev && \
    apt purge build-essential linux-libc-dev git-core openssh-client make -y && \
    apt-get autoclean

WORKDIR /usr/src/app

COPY --from=builder /usr/local/bundle/ /usr/local/bundle/

COPY . /usr/src/app

EXPOSE 3000

I tried this, but it didn't help


RUN gem install -N bundler -v 2.4.0 && \
    bundle config set no-cache 'true' && \
    bundle install && \

RUN gem install bundler -v '2.2.28' && bundle install

RUN rm -rf /usr/local/bundle/cache
0

There are 0 best solutions below