25 days ago
Problem:
Railway finding Dockerfile correctly but providing empty build context to Docker - zero files available during build.
Config:
- NO railway.toml file (using UI configuration)
- Dashboard Settings → Dockerfile Path: frontend/Dockerfile
- Monorepo structure with frontend in /frontend subdirectory
Error:
Build fails at COPY package.json package-lock.json ./ with:
ERROR: failed to compute cache key: "/package.json": not found
Diagnostics performed:
- ls -la / in container shows only standard Linux filesystem - no repo files at all
- find / -name "package.json" returns nothing
- Build context is completely empty before any COPY commands
- Local Docker build with docker build -f frontend/Dockerfile frontend/ works perfectly
- Dockerfile IS being found and executed by Railway (confirmed via debug logs)
Debug output from Dockerfile RUN ls -la /:
total 64
drwxr-xr-x 1 root root 4096 bin
drwxr-xr-x 5 root root 360 dev
drwxr-xr-x 1 root root 4096 etc
... (standard Linux filesystem only - NO repository files)
Attempted fixes:
- Tried with and without Root Directory setting
- Verified .dockerignore doesn't block package.json
- Tested explicit paths in COPY commands
- Cleared build cache and rebuilt from scratch
Question:
When setting Dockerfile Path in UI as frontend/Dockerfile, what build context does Railway use? How do I make Railway provide the /frontend directory contents as build context?
**Project structure:**
/
├── api/
│ └── Dockerfile (separate backend service)
├── frontend/
│ ├── Dockerfile
│ ├── package.json
│ ├── package-lock.json
│ └── src/
Expected: Railway uses frontend/ as build context (standard Docker behavior)
Actual: Build context is completely empty
3 Replies
25 days 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!
Railway
Hey there! We've found the following might help you get unblocked faster: - [🧵 Rust/TS Monorepo](https://station.railway.com/questions/rust-ts-monorepo-37c42b4e) - [🧵 deployment failure - replica never became healthy](https://station.railway.com/questions/deployment-failure-replica-never-beca-5114b651) - [🧵 Unable to deploy from monorepo](https://station.railway.com/questions/unable-to-deploy-from-monorepo-edc16dc5) If you find the answer from one of these, please let us know by solving the thread!
25 days ago
No useful information in those threads sorry.
Status changed to Awaiting Conductor Response noahd • 24 days ago
24 days ago
Hello,
You have your root directory unset, so it defaults to /. The root directory is going to be the build context, and setting a Dockerfile path does not change the build context.
Status changed to Awaiting User Response Railway • 24 days ago
17 days ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 17 days ago