Deploy Service In Shared Monorepo
iatomic1
PROOP

a year 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

66 Replies

a year ago

Are you using a root directory?


iatomic1
PROOP

a year ago

No I'm not

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


a year ago

No railway.json present?


iatomic1
PROOP

a year ago

no


a year ago

🤨


iatomic1
PROOP

a year ago

Very confused rn

It seems i have root dir set here

1434376149869268992


a year ago

Can you share the GitHub URL?


a year ago

Oh.


a year ago

That's a root directory


iatomic1
PROOP

a year ago

You'd have to bear w me 😅


a year ago

Yeah so, just set the Dockerfile directory to be Dockerfile


a year ago

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


a year ago

Which is not what you want 😃


iatomic1
PROOP

a year ago

ohh i get it now

was prev removed the /apps/dex-monitor ...

and now its redeploying


iatomic1
PROOP

a year ago

Failed again but this time, no errors

1434376756407570582


a year ago

That doesn't look like it failed


iatomic1
PROOP

a year ago

it says failed tho

1434377246277111879


iatomic1
PROOP

a year ago

And I've refresh the page


a year ago

Can you screenshot the whole sidebar please


a year ago

I just need to see what's between those two


iatomic1
PROOP

a year ago

1434377557469560842


iatomic1
PROOP

a year ago

this?


a year ago

Hmm


a year ago

What does it say in details?


a year ago

You're right I expected more between those two things


iatomic1
PROOP

a year ago

1434377796842426438


a year ago

😭 what


a year ago

is the repository public


iatomic1
PROOP

a year ago

no it isn't 🥲


a year ago

Can you disable metal build environment then redeploy?

1434378251567894584


iatomic1
PROOP

a year 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/node_modules ./node_modules

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
PROOP

a year ago

ENV NODE_ENV=production

PORT=3000

Copy production dependencies

COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules

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
PROOP

a year ago

now nothing happens

1434378744067522580


a year ago

Your dockerfile path is incorrect


a year ago

Oh. Nice.


a year ago

AI generated? 🤨


a year ago

Okay, can you share your directories and root directory now


iatomic1
PROOP

a year 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
PROOP

a year ago

dexion/

├── apps/

│ └── dex-monitor/

│ └── Dockerfile

| | other apps/services im gonna deploy with railway

└── packages/

1434379965557899425


a year ago

.


a year ago

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


iatomic1
PROOP

a year ago

I set it from the dashboard

is there another way to do it?


a year ago

thats the right way to do it


a year ago

Bleuh


a year ago

once setting redeploy


iatomic1
PROOP

a year ago

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

1434380308253380678


iatomic1
PROOP

a year ago

?


a year ago

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


a year ago

Railway should automatically pick up on it


a year ago

Nope what I suggested is correct


a year ago

you have no error logs


a year ago

<:sadcat:1408269791965478932>


a year ago

That’s confusing


iatomic1
PROOP

a year ago

Yup you were right

Now i fix to fix this shit claude generated

1434380964561424434

1434380965249290392


a year ago

Bountied so the community could help


iatomic1
PROOP

a year ago

@Error can you help me with a better Dockerfile

1434381594373656627


iatomic1
PROOP

a year ago

Ayoo

had no idea you were a staff 😅


a year ago

I'm sure the community can help!


iatomic1
PROOP

a year ago

Thanks

@Sam preciate it as well ❤️


iatomic1
PROOP

a year ago

Fixed this by removing the root dir


iatomic1
PROOP

a year ago

Hey @Sam

Are these railway's bots?

1434392215307812944

1434392215710470164


a year ago

Just random bots on the internet


a year ago

It’s fine to ignore


iatomic1
PROOP

a year ago

damn

i haven't even used it 😅


a year ago

!s


Status changed to Solved samgordon • 11 months ago


a year ago

:(


Welcome!

Sign in to your Railway account to join the conversation.

Loading...