Deploying new rails app
joelmoss
PROOP

25 days ago

I have a Rails app created from a GH repo, and every deploy fails at the build stage...

bundle install
642ms
Don't run Bundler as root. Installing your bundle as root will break this
application for all non-root users on this machine.
/usr/local/bundle/gems/bundler-2.7.2/lib/bundler.rb:524:in 'File#initialize': No such file or directory @ rb_sysopen - /app/.ruby-version (Errno::ENOENT)

Attachments

Solved$10 Bounty

Pinned Solution

darseen
HOBBYTop 1% Contributor

25 days ago

This is the line that's causing the error: ruby file: '.ruby-version' . Replace it with: ruby '<version>' . Example: ruby '4.0.1'

8 Replies

darseen
HOBBYTop 1% Contributor

25 days ago

The error causing the crash is: No such file or directory @ rb_sysopen - /app/.ruby-version .
.ruby-version might be in your .gitignore . So, you need to remove it.
If the file doesn't exist, you need to create it at the root of your project and push it to your github repo.


darseen

The error causing the crash is: No such file or directory @ rb_sysopen - /app/.ruby-version ..ruby-version might be in your .gitignore . So, you need to remove it. If the file doesn't exist, you need to create it at the root of your project and push it to your github repo.

joelmoss
PROOP

25 days ago

Thx, but that file does exist, and is not ignored by git.

That also doesn't explain why it says Don't run Bundler as root.


darseen
HOBBYTop 1% Contributor

25 days ago

The Don't run Bundler as root message is a warning, not the error. The actual crash is happening because the build process can't find .ruby-version. It'sa standard warning in docker containers.

Since you confirmed the file is in your github repo. Then the problem must be in your Dockerfile . Check if your are copying the file.

COPY Gemfile Gemfile.lock .ruby-version ./ # <-- check this
RUN bundle install
COPY . .


darseen

The Don't run Bundler as root message is a warning, not the error. The actual crash is happening because the build process can't find .ruby-version. It'sa standard warning in docker containers.Since you confirmed the file is in your github repo. Then the problem must be in your Dockerfile . Check if your are copying the file.COPY Gemfile Gemfile.lock .ruby-version ./ # <-- check this RUN bundle install COPY . .

joelmoss
PROOP

25 days ago

But I also don't have a Dockerfile


darseen
HOBBYTop 1% Contributor

25 days ago

Well... At this point, I need more information to help you fix it. Can you share your Gemfile?


darseen

Well... At this point, I need more information to help you fix it. Can you share your Gemfile?

joelmoss
PROOP

25 days ago


darseen
HOBBYTop 1% Contributor

25 days ago

This is the line that's causing the error: ruby file: '.ruby-version' . Replace it with: ruby '<version>' . Example: ruby '4.0.1'


joelmoss
PROOP

25 days ago

That did it. Thx


Status changed to Solved ray-chen 25 days ago


Loading...