Dockerfile Issue

reimc85
FREE

a month ago

I'm having a persistent issue with my frontend service in a monorepo. It keeps building with Nixpacks/Railpack, even though I have a Dockerfile in the repo root and have configured the service to use it.
Details:
Project ID: 66ac5949-c473-4020-9df2-c6746890ad32

Structure: Dockerfile is in repo root (./Dockerfile), frontend code is in ./frontend/.

Service Config:
Root Directory: /frontend
RAILWAYDOCKERFILEPATH variable: Dockerfile

Problem:
Build logs consistently show Using Nixpacks despite these settings. The Dockerfile is being ignored.
Troubleshooting done: Tried various RAILWAYDOCKERFILEPATH values, created a new service, deleted the old one.
Initially, when creating a new frontend service during troubleshooting, the Railway UI briefly showed "Dockerfile" as the detected builder, which was promising.
However, after the first build, it reverted to "Nixpacks Default" and has remained there.

Could you please help me understand why Railway isn't detecting/using my Dockerfile for this service?

Solved

0 Replies

a month ago

Hey, Railway will not detect the Dockerfile at the root if your have set your root directory to /frontend, as this is now viewed in an isolated manner. You can move the Dockerfile to /frontend and Railway will detect it.


reimc85
FREE

a month ago

Ah thank you, I will give that a try.


a month ago

Hey @ReimC85, did the approach I suggested work out for you?


reimc85
FREE

a month ago

Yes, absolutely. Thank you.
I had a sliver of hope until I ran into another issue shortly after fixing this one.

I'm encountering a very persistent issue with my frontend service.
Despite successfully moving my Dockerfile to frontend/Dockerfile and updating its contents, configuring the service's Root Directory to /frontend, and ensuring my App.jsx on GitHub contains all the latest changes (including HashRouter and rendering Home on the root path), the live site is still serving an old version of the application.
My build logs confirm Using Detected Dockerfile and Compiled successfully, and my server.js is correctly pointing to the build output.
This suggests a deep caching or deployment pipeline issue on Railway's end, as the correct code is simply not making it to production. Not sure why the deployed version isn't reflecting the latest successful build?


a month ago

Are you committing your dist (or similar) folder to GitHub?


reimc85
FREE

a month ago

Thanks for the pointer! You were absolutely right.

I didn’t have a .gitignore file in my frontend directory, so the dist folder was indeed being committed to GitHub.

I’ve now:

1.    Created a `.gitignore` file in `frontend/` and added `/dist` and `/node_modules` to it.
2.    Manually deleted the `dist` folder from my GitHub repository via the web interface.

a month ago

Did that fix it?


reimc85
FREE

a month ago

In the end yes. After I changed the above I noticed nothing different. I totally forgot I had made a duplicate front end folder in my troubleshooting which made a new URL, and I was still trying to use the old URL which would explain why no changes were being updated 🤦‍♂️


a month ago

That would do it to, I just spent 5 minutes trying to figure out why I couldn't connect to a Postgres database until I realized I had mistakenly selected Redis as the database type in my database client, happens to the best of us.


reimc85
FREE

a month ago

Thank you again for the advice, it’s been a long 2 days troubleshooting a self made issue that seems so obvious now haha


a month ago

No problem!


25 days ago

!s


Status changed to Solved brody 25 days ago


Dockerfile Issue - Railway Help Station