Deploy Service In Shared Monorepo
iatomic1
HOBBYOP

a month ago

Environment

Monorepo Type: Turborepo with Bun
Project Structure: Multi-service monorepo with shared packages
CLI Version: Latest Railway CLI
Deployment Method: railway up command and via GitHub

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:

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

Solved$10 Bounty

0 Replies

Are you using a root directory?


iatomic1
HOBBYOP

a month ago

No I'm not
I'm calling the railway up command from the root of my project


No railway.json present?


iatomic1
HOBBYOP

a month ago

no



iatomic1
HOBBYOP

a month ago

Very confused rn
It seems i have root dir set here

1434376149869269000


Can you share the GitHub URL?



That's a root directory


iatomic1
HOBBYOP

a month ago

You'd have to bear w me 😅


Yeah so, just set the Dockerfile directory to be Dockerfile


It's looking for /apps/dex-monitor/apps/dex-monitor/Dockerfile


Which is not what you want 😃


iatomic1
HOBBYOP

a month ago

ohh i get it now
was prev removed the /apps/dex-monitor …
and now its redeploying


iatomic1
HOBBYOP

a month ago

Failed again but this time, no errors

1434376756407570700


That doesn't look like it failed


iatomic1
HOBBYOP

a month ago

it says failed tho

1434377246277111800


iatomic1
HOBBYOP

a month ago

And I've refresh the page


Can you screenshot the whole sidebar please


I just need to see what's between those two


iatomic1
HOBBYOP

a month ago

1434377557469560800


iatomic1
HOBBYOP

a month ago

this?



What does it say in details?


You're right I expected more between those two things


iatomic1
HOBBYOP

a month ago

1434377796842426400


😭 what


is the repository public


iatomic1
HOBBYOP

a month ago

no it isn't 🥲


noahd
EMPLOYEE

a month ago

Can you disable metal build environment then redeploy?

1434378251567894500


iatomic1
HOBBYOP

a month ago

or might there me smthn wrong with my Dockerfile?

============================

Base image

============================

FROM oven/bun:latest AS base
RUN apk add --no-cache dumb-init
WORKDIR /app
RUN addgroup -g 1001 -S appgroup \
&& adduser -S appuser -u 1001 -G appgroup \
&& chown -R appuser:appgroup /app

============================

Dependencies stage

============================

FROM base AS deps
WORKDIR /app

Copy package files

COPY --chown=appuser:appgroup package.json bun.lockb* ./

Copy only the packages we need (adjust based on your actual dependencies)

COPY --chown=appuser:appgroup packages/logger ./packages/logger
COPY --chown=appuser:appgroup packages/notifier ./packages/notifier
COPY --chown=appuser:appgroup packages/shared ./packages/shared
COPY --chown=appuser:appgroup packages/tokens ./packages/tokens
COPY --chown=appuser:appgroup packages/typescript-config ./packages/typescript-config

Copy dex-monitor app

COPY --chown=appuser:appgroup apps/dex-monitor/package.json ./apps/dex-monitor/package.json

Install all dependencies

RUN bun install --frozen-lockfile

============================

Build stage

============================

FROM base AS builder
WORKDIR /app

Copy installed dependencies

COPY --from=deps --chown=appuser:appgroup /app/nodemodules ./nodemodules
COPY --from=deps --chown=appuser:appgroup /app/packages ./packages

Copy app source

COPY --chown=appuser:appgroup apps/dex-monitor ./apps/dex-monitor
COPY --chown=appuser:appgroup package.json bun.lockb* ./

Prune dev dependencies

RUN bun install --frozen-lockfile --production

============================

Production stage

============================

FROM base AS production
WORKDIR /app


iatomic1
HOBBYOP

a month ago

ENV NODE_ENV=production \
PORT=3000

Copy production dependencies

COPY --from=builder --chown=appuser:appgroup /app/nodemodules ./nodemodules
COPY --from=builder --chown=appuser:appgroup /app/packages ./packages
COPY --from=builder --chown=appuser:appgroup /app/apps/dex-monitor ./apps/dex-monitor
COPY --from=builder --chown=appuser:appgroup /app/package.json ./

USER appuser
EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --quiet --spider http://localhost:3000/health || exit 1

ENTRYPOINT ["dumb-init", "--"]
CMD ["bun", "run", "apps/dex-monitor/src/index.ts"]


iatomic1
HOBBYOP

a month ago

now nothing happens

1434378744067522600


noahd
EMPLOYEE

a month ago

Your dockerfile path is incorrect


Oh. Nice.


AI generated? 🤨


Okay, can you share your directories and root directory now


iatomic1
HOBBYOP

a month ago

on a second thought, yh 🥲
is there smthn wrong w it? i had someone vet it tho, would appreciate your insights on it 😭


iatomic1
HOBBYOP

a month ago

dexion/
├── apps/
│ └── dex-monitor/
│ └── Dockerfile
| | other apps/services im gonna deploy with railway
└── packages/

1434379965557899500


noahd
EMPLOYEE

a month ago

.


noahd
EMPLOYEE

a month ago

when you click on Dockerfile Path it should pop up and suggest where it is


iatomic1
HOBBYOP

a month ago

I set it from the dashboard
is there another way to do it?


noahd
EMPLOYEE

a month ago

thats the right way to do it



noahd
EMPLOYEE

a month ago

once setting redeploy


iatomic1
HOBBYOP

a month ago

@Sam said this resolves to /apps/dex-monitor/apps/dex-monitor… because of the root dir

1434380308253380600


iatomic1
HOBBYOP

a month ago

?


Yeah I’m 99% sure that should just be Dockerfile or even try setting it to nothing


Railway should automatically pick up on it


noahd
EMPLOYEE

a month ago

Nope what I suggested is correct


noahd
EMPLOYEE

a month ago

you have no error logs


<:sadcat:1408269791965478932>


That’s confusing


iatomic1
HOBBYOP

a month ago

Yup you were right
Now i fix to fix this shit claude generated

1434380964561424400
1434380965249290500


noahd
EMPLOYEE

a month ago

Bountied so the community could help


iatomic1
HOBBYOP

a month ago

@Error can you help me with a better Dockerfile

1434381594373656600


iatomic1
HOBBYOP

a month ago

Ayoo
had no idea you were a staff 😅


noahd
EMPLOYEE

a month ago

I'm sure the community can help!


iatomic1
HOBBYOP

a month ago

Thanks
@Sam preciate it as well ❤️


iatomic1
HOBBYOP

a month ago

Fixed this by removing the root dir


iatomic1
HOBBYOP

a month ago

Hey @Sam
Are these railway's bots?

1434392215307812900
1434392215710470100


Just random bots on the internet


It’s fine to ignore


iatomic1
HOBBYOP

a month ago

damn
i haven't even used it 😅



Status changed to Solved samgordon about 1 month ago



Loading...