docker-rails-example icon indicating copy to clipboard operation
docker-rails-example copied to clipboard

Deploy to Heroku

Open AJuliette opened this issue 1 year ago • 7 comments

Here is my repo: https://github.com/AJuliette/journees-du-patrimoine I tried @paulofabiano's solution, but I'm still getting a precompiling assets failed. Could someone give me a hand ?

Screenshot 2024-08-15 at 15 08 42

AJuliette avatar Aug 15 '24 13:08 AJuliette

Is everything running in a container through Heroku?

Just the other week someone reported that it's working here https://github.com/nickjj/docker-rails-example/issues/82 after following the solution you linked.

nickjj avatar Aug 15 '24 13:08 nickjj

I'm sorry, I don't have an ops background. I just created an app and linked it to my github repo and tried to deploy main.

AJuliette avatar Aug 15 '24 13:08 AJuliette

You mentioned following the steps in the solution, but the solution mentions creating a heroku.yml file which runs the app in a container. Did you perform that step?

nickjj avatar Aug 15 '24 13:08 nickjj

Yes it's there: https://github.com/AJuliette/journees-du-patrimoine/blob/main/heroku.yml

AJuliette avatar Aug 15 '24 13:08 AJuliette

Thanks.

I don't use Heroku personally but I wonder if it'll work if you change the .yarnrc file from --modules-folder /node_modules to --modules-folder /tmp/node_modules. To go along with that change you'll want to update the Dockerfile to change the (3) spots where /node_modules is referenced to /tmp/node_modules. They are on lines 19 and 33.

Can you try doing that, rebuilding and see if things work?

nickjj avatar Aug 15 '24 14:08 nickjj

It buids locally but it still fails on Heroku (with a different error !):

Screenshot 2024-08-15 at 16 33 35

Which soution do you use ? I just want to put this on prod ^^"

AJuliette avatar Aug 15 '24 14:08 AJuliette

That error indicates esbuild cannot be found. Truthfully I don't know why Heroku isn't using the correct image. It's possible something has changed in the year or so since that answer was provided. You may want to Google around how to get Heroku and multi-stage builds to work with Heroku.

I typically deploy my apps to a virtual private server, such as a $10 / month DigitalOcean server and use Docker Compose to run the app.

nickjj avatar Aug 15 '24 14:08 nickjj