Skip to content
Dockerfile lookups & build ignore step using turborepo
pompa
OP

10 months ago

I set my root as . in the monorepo using turbo. This is because during build I run turbo purge to ensure all relevant packages are moved to the build step.

However, this means that railway checks for multiple places for the Dockerfile.

I defined where Dockerfile already is in railway.json but seems it doesn't use that as the true source.

According to docs, the path should start with "/path". I have tried both with and without but builder is still checking for all various paths to find a relevant Dockerfile.

Unnecessary seconds spent here 🤣

What is the common practice for building turborepo monorepos?

Also, is there a way to have something like "build ignore" similar to Vercel where I can run turbo-ignore to see if we even need to build the app or package in the first place?

https://turborepo.dev/docs/reference/turbo-ignore

There is a pre-deploy but I couldn't a pre-build that works together with Docker building.

I want to avoid maintaining watch patterns myself: https://docs.railway.com/guides/build-configuration#configure-watch-paths

config-as-code path set as '/apps/server/railway.json'
skipping 'Dockerfile' at 'apps/server/Dockerfile' as it is not rooted at a valid path (root_dir=, fileOpts={acceptChildOfRepoRoot:false})
found config-as-code file at 'apps/server/railway.json'
skipping 'Dockerfile' at 'apps/web/Dockerfile' as it is not rooted at a valid path (root_dir=, fileOpts={acceptChildOfRepoRoot:false})
skipping 'railway.json' at 'apps/web/railway.json' as it is not rooted at a valid path (root_dir=, fileOpts={acceptChildOfRepoRoot:true})
skipping 'Dockerfile' at 'apps/www/Dockerfile' as it is not rooted at a valid path (root_dir=, fileOpts={acceptChildOfRepoRoot:false})
skipping 'railway.json' at 'apps/www/railway.json' as it is not rooted at a valid path (root_dir=, fileOpts={acceptChildOfRepoRoot:true})
config-as-code path sanitized to 'apps/server/railway.json'
Closed

9 Replies

10 months ago

What do you have your Dockerfile path set to?


pompa
OP

10 months ago

  "$schema": "https://railway.com/railway.schema.json",
  "build": {
    "dockerfilePath": "/apps/server/Dockerfile"
  },
  "deploy": {
    "runtime": "V2",
    "numReplicas": 2,
    "sleepApplication": false,
    "multiRegionConfig": {
      "europe-west4-drams3a": {
        "numReplicas": 1
      }
    },
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 10
  }
}

pompa
OP

10 months ago

Dockerfile lookups & build ignore step


pompa
OP

10 months ago

Dockerfile lookups & build ignore step using turborepo


10 months ago

What exactly is your root directory set to in your service settings?


pompa
OP

10 months ago

I haven't specified it so it's the root of the whole repo.

Screenshot_2026-02-11_at_09.08.26.png


10 months ago

Do we not end up using the Dockerfile you specify?


pompa
OP

10 months ago

in the end yes, but since I am referencing it in railway.json, I am surprised that it doesn't use what's defined there and run with that.


pompa
OP

10 months ago

The process spends time on checking other paths before finding the right one...


Welcome!

Sign in to your Railway account to join the conversation.

Loading...