I am writing a multi-stage docker build but I am getting this error
In Gemfile:
rails was resolved to 7.1.3.3, which depends on
actioncable was resolved to 7.1.3.3, which depends on
actionpack was resolved to 7.1.3.3, which depends on
actionview was resolved to 7.1.3.3, which depends on
rails-dom-testing was resolved to 2.2.0, which depends on
activesupport was resolved to 7.1.3.3, which depends on
bigdecimal
Muti-stage Dockerfile
FROM ruby:slim-bullseye as base
# Set the working directory inside the container
WORKDIR /app
# Install dependencies
RUN apt-get update &&
apt-get install -y nodejs
RUN gem install bundler
COPY Gemfile* ./
RUN bundle install
# Copy the rest of the application code
COPY . .
# Stage 2: Final stage
FROM ruby:slim-bullseye as base
# Set the working directory inside the container
WORKDIR /app
# Copy built application from the builder stage
COPY --from=builder /app .
# Expose port 3000 to the outside world
EXPOSE 3000
# Start the Rails server
CMD ["rails", "server", "-b", "0.0.0.0"]
But this single stage Dockerfile works
FROM ruby:slim-bullseye as base
# Set the working directory inside the container
WORKDIR /app
# Install dependencies
RUN apt-get update &&
apt-get install -y nodejs
RUN gem install bundler
COPY Gemfile* ./
RUN bundle install
# Copy the rest of the application code
COPY . .
# Stage 2: Final stage
FROM ruby:slim-bullseye as base
# Set the working directory inside the container
WORKDIR /app
# Copy built application from the builder stage
COPY --from=builder /app .
# Expose port 3000 to the outside world
EXPOSE 3000
# Start the Rails server
CMD ["rails", "server", "-b", "0.0.0.0"]
How do I resolve this?