Deploy Service In Shared Monorepo
iatomic1
PROOP

8 months 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

8 months ago

Are you using a root directory?


iatomic1
PROOP

8 months ago

No I'm not

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


8 months ago

No railway.json present?


iatomic1
PROOP

8 months ago

no


8 months ago

🤨


iatomic1
PROOP

8 months ago

Very confused rn

It seems i have root dir set here

1434376149869268992


8 months ago

Can you share the GitHub URL?


8 months ago

Oh.


8 months ago

That's a root directory


iatomic1
PROOP

8 months ago

You'd have to bear w me 😅


8 months ago

Yeah so, just set the Dockerfile directory to be Dockerfile


8 months ago

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


8 months ago

Which is not what you want 😃


iatomic1
PROOP

8 months ago

ohh i get it now

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

and now its redeploying


iatomic1
PROOP

8 months ago

Failed again but this time, no errors

1434376756407570582


8 months ago

That doesn't look like it failed


iatomic1
PROOP

8 months ago

it says failed tho

1434377246277111879


iatomic1
PROOP

8 months ago

And I've refresh the page


8 months ago

Can you screenshot the whole sidebar please


8 months ago

I just need to see what's between those two


iatomic1
PROOP

8 months ago

1434377557469560842


iatomic1
PROOP

8 months ago

this?


8 months ago

Hmm


8 months ago

What does it say in details?


8 months ago

You're right I expected more between those two things


iatomic1
PROOP

8 months ago

1434377796842426438


8 months ago

😭 what


8 months ago

is the repository public


iatomic1
PROOP

8 months ago

no it isn't 🥲


8 months ago

Can you disable metal build environment then redeploy?

1434378251567894584


iatomic1
PROOP

8 months 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

8 months 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

8 months ago

now nothing happens

1434378744067522580


8 months ago

Your dockerfile path is incorrect


8 months ago

Oh. Nice.


8 months ago

AI generated? 🤨


8 months ago

Okay, can you share your directories and root directory now


iatomic1
PROOP

8 months 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

8 months ago

dexion/

├── apps/

│ └── dex-monitor/

│ └── Dockerfile

| | other apps/services im gonna deploy with railway

└── packages/

1434379965557899425


8 months ago

.


8 months ago

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


iatomic1
PROOP

8 months ago

I set it from the dashboard

is there another way to do it?


8 months ago

thats the right way to do it


8 months ago

Bleuh


8 months ago

once setting redeploy


iatomic1
PROOP

8 months ago

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

1434380308253380678


iatomic1
PROOP

8 months ago

?


8 months ago

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


8 months ago

Railway should automatically pick up on it


8 months ago

Nope what I suggested is correct


8 months ago

you have no error logs


8 months ago

<:sadcat:1408269791965478932>


8 months ago

That’s confusing


iatomic1
PROOP

8 months ago

Yup you were right

Now i fix to fix this shit claude generated

1434380964561424434

1434380965249290392


8 months ago

Bountied so the community could help


iatomic1
PROOP

8 months ago

@Error can you help me with a better Dockerfile

1434381594373656627


iatomic1
PROOP

8 months ago

Ayoo

had no idea you were a staff 😅


8 months ago

I'm sure the community can help!


iatomic1
PROOP

8 months ago

Thanks

@Sam preciate it as well ❤️


iatomic1
PROOP

8 months ago

Fixed this by removing the root dir


iatomic1
PROOP

8 months ago

Hey @Sam

Are these railway's bots?

1434392215307812944

1434392215710470164


8 months ago

Just random bots on the internet


8 months ago

It’s fine to ignore


iatomic1
PROOP

8 months ago

damn

i haven't even used it 😅


8 months ago

!s


Status changed to Solved samgordon 8 months ago


8 months ago

:(


Welcome!

Sign in to your Railway account to join the conversation.

Loading...