R
Railway•8mo ago
codebytom

railway.json config file is ignored in favour of Dockerfile

I have a Dockerfile which I am using for local development, and I've also got a railway.json file defined in the root of my project for deployments.
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "npm run build"
},
"deploy": {
"startCommand": "npm run start",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 3
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "npm run build"
},
"deploy": {
"startCommand": "npm run start",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 3
}
}
But whenever I try and deploy I get the following in the build logs: Using Detected Dockerfile I also see the attached image under the "Details" tab of my last deployment, where again it is referencing Docker as the builder. It appears as though it's either ignoring, or not picking up my railway.json file. Any ideas? Thanks.
No description
7 Replies
Percy
Percy•8mo ago
Project ID: aeb99429-e5df-408c-bcd0-ac3875a1c926
codebytom
codebytom•8mo ago
Project ID: aeb99429-e5df-408c-bcd0-ac3875a1c926
Brody
Brody•8mo ago
a Dockerfile if present will always be used, instead you can rename it to something like Dockerfile.dev
codebytom
codebytom•8mo ago
Gotcha! Is this specified in the docs? If it was I must have missed it. If not, I may contribute. I see it is here: https://docs.railway.app/deploy/config-as-code
Note: Railway will always build with a Dockerfile if it finds one. To build with nixpacks, you can remove or rename the Dockerfile..
Brody
Brody•8mo ago
haha linked it before I could
codebytom
codebytom•8mo ago
Ha! All sorted now. Appreciate the help, Brody. Have a good day.
Brody
Brody•8mo ago
you too! 🙂