railwayapp / nixpacks

App source + Nix packages + Docker = Image
https://nixpacks.com
MIT License
2.47k stars 232 forks source link

Ruby projects can occasionally fail to build #943

Open mattsrobot opened 1 year ago

mattsrobot commented 1 year ago

Is there an existing issue for this?

Describe the bug

Dear Railway team,

I've noticed occasionally, using a Ruby nixpacks project, builds can fail at a certain step, and cause Railway to rebuild the project for quite a long time (typically 30 minutes unless manually cancelled).

The particular step is this line:

#10 [stage-0  6/15] RUN  curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash -s stable && printf '\neval "$(~/.rbenv/bin/rbenv init -)"' >> /root/.profile && . /root/.profile && rbenv install 3.2.2 && rbenv global 3.2.2 && gem install bundler:2.4.6

Resulting with an error, deadline exceeded:

Xnapper-2023-08-07-17 18 01 Xnapper-2023-08-07-17 05 17 Xnapper-2023-08-07-17 02 24

One note additionally,

I've noticed gems don't seemed to be cached between builds, is it possible to add some sort of cache between builds? The longest part of building the project seems to be related to gem installation. Typical build time is around 10 minutes.

To reproduce

any ruby project (3.2.2) - intermittent failure.

Expected behavior

Should install

Environment

Production

coffee-cup commented 1 year ago

Thanks for the bug report! I suspect that builds are timing out. Properly caching the gems between builds should help quite a bit.

nickmacavoy commented 1 year ago

@mattsrobot have a look in here for a way to cache ruby builds https://github.com/railwayapp/nixpacks/pull/817#issuecomment-1475032321