docs
docs copied to clipboard
Build Fails with Unsupported Ruby
File: samples/rails.md
The Dockerfile uses ruby 2.5 however if you try to run this build you will find that an error is thrown:
#0 112.4 Fetching minitest 5.16.3
#0 117.5 Installing minitest 5.16.3
#0 117.6 Gem::RuntimeRequirementNotMetError: minitest requires Ruby version >= 2.6, <
One Solution
I did get a build to work by using the following, which involved adding yarn as a package, ruby 3.1.2 and rails 7.0.3:
Dockerfile:
# syntax=docker/dockerfile:1
FROM ruby:3.1.2
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client yarn
WORKDIR /sneakerr
COPY Gemfile /sneakerr/Gemfile
COPY Gemfile.lock /sneakerr/Gemfile.lock
RUN bundle install
# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
# Configure the main process to run when running the image
CMD ["rails", "server", "-b", "0.0.0.0"]
Gemfile:
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.2"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.4"
Running the usual commands as given in the tutorial worked with these files and what is there currently.
Trying to get a ruby 2.7 build to work currently.