4 months ago
We have a monorepo with 3 services (backend, frontend, bots), each with its own Dockerfile. We initially tried deploying each service individually by setting Root Directory: apps/[service], but ran into build failures because workspace dependencies (shared packages) are outside the build context.
We're now deploying all services from the repository root (Root Directory: .,Dockerfile Path: apps/[service]/Dockerfile), which resolves the workspace dependencies.
Questions:
1. Is this the recommended approach for monorepos with shared packages?
2. In the template editor, I can configure source/root directory but not explicitly choose Docker vs Buildpacks - does Railway auto-detect from Dockerfile presence?
3. Any best practices or gotchas we should know about?
Structure:
/
├── apps/
│ ├── backend/Dockerfile
│ ├── frontend/Dockerfile
│ └── bots/Dockerfile
├── packages/
│ └── shared/ (workspace dependencies)
├── Cargo.toml (Rust workspace)
└── package.json (Bun workspace)2 Replies
4 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
Status changed to Solved trevor-trinh • 4 months ago
4 months ago
Added RAILWAY_DOCKERFILE_PATH to each subcomponent
Status changed to Awaiting Railway Response Railway • 4 months ago
Status changed to Solved brody • 4 months ago