Unable to deploy from monorepo
iatomic1
HOBBYOP

a month ago

Description:

Environment

  • Monorepo Type: Turborepo with Bun

  • Project Structure: Multi-service monorepo with shared packages

  • CLI Version: Latest Railway CLI

  • Deployment Method: railway up command

Project Structure

.
├── apps/
│   ├── backend/
│   ├── dex-monitor/          # Service I'm trying to deploy
│   │   ├── Dockerfile
│   │   ├── package.json
│   │   └── src/
│   ├── dex-bot/
│   └── ... (7 more apps)
└── packages/                  # Shared workspace packages
    ├── api-sdk/
    ├── dex-engine/
    ├── logger/
    └── ... (10 more packages)

Issue Description

I'm attempting to deploy a single service (apps/dex-monitor) from my monorepo that depends on shared packages in packages/*. The build consistently fails with a dockerfile path error.

Configuration Attempted

Dashboard Settings:

  • Builder: Dockerfile

  • Dockerfile Path: apps/dex-monitor/Dockerfile (no leading slash)

Commands Tried

bash

# Command 1
railway up --service dex-monitor

# Command 2
railway up --service dex-monitor --dockerfile apps/dex-monitor/Dockerfile
```

### Build Error Output
```
scheduling build on Metal builder "builder-ghemuq"
[snapshot] receiving snapshot, complete 12 MB [took 3.107177548s]
[snapshot] unpacking archive, complete 15 MB [took 147.073458ms]
internal
load build definition from /apps/dex-monitor/Dockerfile
0ms
Build Failed: bc.Build: failed to solve: failed to read dockerfile: open /apps/dex-monitor/Dockerfile: no such file or directory

Key Observations

  1. The error shows Railway is looking for /apps/dex-monitor/Dockerfile (with leading slash) even though I specified apps/dex-monitor/Dockerfile (relative path)

  2. The Dockerfile definitely exists at apps/dex-monitor/Dockerfile in my repository

  3. The snapshot uploads successfully (12 MB)

  4. Without the Dockerfile configuration, Railway defaults to Railpack and fails with "No start command was found"

Dockerfile Overview

My Dockerfile is a multi-stage build that:

  1. Copies shared packages from packages/*

  2. Installs dependencies with Bun

  3. Builds the service

  4. Creates a production image

The Dockerfile uses paths like:

dockerfile

COPY --chown=appuser:appgroup packages/api-sdk ./packages/api-sdk
COPY --chown=appuser:appgroup apps/dex-monitor ./apps/dex-monitor

What I've Already Tried

  • Verified Dockerfile exists at the specified path

  • Tried both CLI flag and railway.toml configuration

  • Tried with and without leading slash in path

  • Created comprehensive .dockerignore to reduce upload size

  • Confirmed builder is set to "dockerfile" (lowercase)

  • Tested from both CLI and Dashboard configurations

Expected Behavior

Railway should read the Dockerfile from apps/dex-monitor/Dockerfile relative to the project root and build the Docker image successfully.

Additional Context

This is a production service that needs to share code with other services in the monorepo. Other services (backend, dex-bot, wallet-tracker) will also need similar deployment configurations.

Any guidance on the correct monorepo + multi-service deployment pattern would be greatly appreciated!

$10 Bounty

2 Replies

Railway
BOT

a month 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: - [🧵 Dockerfile Path](https://station.railway.com/questions/dockerfile-path-4bb0a017) - [🧵 npm error path /app](https://station.railway.com/questions/npm-error-path-app-b179d84a) - [🧵 Deploy keeps failing at database error](https://station.railway.com/questions/deploy-keeps-failing-at-database-error-efcfe072) If you find the answer from one of these, please let us know by solving the thread!

iatomic1
HOBBYOP

a month ago

Haven't fixed it yet


Loading...