6 months ago
The deployment for my app keeps failing when it gets to this part of my Dockerfile (line 38):
(apologies for not knowing how to do code snippets)
✕ [build 3/6] RUN bundle install && rm -rf ~/.bundle/ "/usr/local/bundle"/ruby//cache "/usr/local/bundle"/ruby//bundler/gems/*/.git && bundle exec bootsnap precompile --gemfile
with this error message:
ERROR: failed to solve: process "/bin/sh -c bundle install && rm -rf ~/.bundle/ \"${BUNDLEPATH}\"/ruby//cache \"${BUNDLEPATH}\"/ruby//bundler/gems/*/.git && bundle exec bootsnap precompile --gemfile" did not complete successfully: exit code: 5
Looking through the logs it reads:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/bundle/ruby/3.2.0/gems/pg-1.5.9/ext
/usr/local/bin/ruby extconf.rb
Calling libpq with GVL unlocked
checking for pg_config… no
checking for libpq per pkg-config… no
Using libpq from
checking for libpq-fe.h… no
Can't find the 'libpq-fe.h header
And that it is "Unable to find PostgreSQL client library."
It seems to be related to not being able to install the pg gem, from what I understand, because of not being able to find the header, or maybe unable to read/locate the pg_config file?
At first, $ gem install pg wasn't working on my local comp but I uninstalled pg, uninstalled libpq-dev, uninstalled a second version of postgres I had on the local computer (14. Now just have 17) and then reinstalled both the libpg-dev and pg gem. PG gem install then worked fine, so I'm not sure why it's failing in deploy when trying to install that gem.
In my Railway project I have first added Redis and Postgres (if that is applicable). I'm running WSL2 with Ubuntu 20.04 Jammy and using rbenv as a package manager for Ruby (maybe that has something to do with it because of file structure of where gems are installed? Maybe not pertinent).
Happy to provide a link to github repo thas houses the code if that is helpful, as well.
This is not a major app it's just something I'm working on for The Odin Project and this is the section where we're supposed to deploy, so I would love to get this sorted so I can get back to curriculum. Thank you in advance for any replies!
ⓘ Deployment information is only viewable by project members and Railway employees.
5 Replies
6 months ago
Hello,
I'm really sorry to say but we aren't able to offer project help here, please make sure your Dockerfile is working locally before attempting to have Railway build and deploy with it.
Best,
Brody
brody
Hello,I'm really sorry to say but we aren't able to offer project help here, please make sure your Dockerfile is working locally before attempting to have Railway build and deploy with it.Best,Brody
6 months ago
Thank you for the response brody. As I mentioned in the post, I'm not having any problems running this locally. The pg gem seems to be fine when being installed locally and don't run into any issue with the postgresql database I'm connect to locally. Only when I try to deploy does this happen.
6 months ago
Yes but are you able to build and image with your Dockerfile and BuildKit locally?
brody
Yes but are you able to build and image with your Dockerfile and BuildKit locally?
6 months ago
I have not tried this. My apologies. Thank you for your assistance. Will try again if I can get it working there locally
6 months ago
Sounds good! - Testing locally with the Dockerfile and BuildKit (we use buildkit) will allow you to debug the issue much easier.