Having Issue with my MONOREPO building image
justkira
PROOP

a year ago

Build failing from local packages in my monorepo, i have tested build locally it must be ran from root, not sure if Railway does the same or modify things.

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

Solved

27 Replies

brody
EMPLOYEE

a year ago

Hello,

Are you able to build with the Dockerfile locally? please confirm that before attempting to have Railway build the Dockerfile.


brody

Hello,Are you able to build with the Dockerfile locally? please confirm that before attempting to have Railway build the Dockerfile.

justkira
PROOP

a year ago

I've tested everything locally, and it works fine. In my Railway project, I have three services running the same Docker setup. However, two of them fail while one succeeds.

The one that works (called "Puzzle") does not require any "compiled package"—meaning it doesn't need a build process like vite build to generate a dist folder. Instead, it only references local packages that contain configuration files. This Docker container runs without issues.

I suspect the problem might be related to Moonrepo and how it interacts with Railway, but I'm not entirely sure. I haven't been able to find anything useful to debug the issue. Any guidance would be appreciated.


brody
EMPLOYEE

a year ago

Hello,

We do not do anything special with the build, can you please confirm if you are able to build with the Dockerfile locally?


brody

Hello,We do not do anything special with the build, can you please confirm if you are able to build with the Dockerfile locally?

justkira
PROOP

a year ago

yes build work locally


brody
EMPLOYEE

a year ago

Sorry I'm not talking about building your application with npm run build - I am talking about building with the Dockerfile.


justkira
PROOP

a year ago

Yes im talking about Dockfile


justkira
PROOP

a year ago

Here this is build for the Studio folder


brody
EMPLOYEE

a year ago

Is this done with BuildKit? Railway's builds are done with BuildKit.


justkira
PROOP

a year ago

not sure what is that tbh xD


brody
EMPLOYEE

a year ago

Please confirm your Dockerfile is able to be built with BuildKit


justkira
PROOP

a year ago

What is BuildKit is it like flag or something can't find anything about for some reason


brody
EMPLOYEE

a year ago

There are many great resources on BuildKit out there.


brody
EMPLOYEE

a year ago

One thing to note, since you correctly have the root directory unset, the build is ran from the root of the project, but your Dockerfile copies files in as if the build was ran from within the /apps/platform folder.


brody

One thing to note, since you correctly have the root directory unset, the build is ran from the root of the project, but your Dockerfile copies files in as if the build was ran from within the /apps/platform folder.

justkira
PROOP

a year ago

What does that mean since you correctly have the root directory unset,


brody

There are many great resources on BuildKit out there.

justkira
PROOP

a year ago

also is there any services online that i can use install buildkit seems like hassel can get it working on windows or wsl 2 for some reason


justkira

What does that mean since you correctly have the root directory unset,

brody
EMPLOYEE

a year ago

You do not have a root directory set, in other words, your root directory is unset -

This is not to say that you should set a root directory, you shouldn't set one since you have a shared monorepo, I'm just stating an observation.

Attachments


justkira
PROOP

a year ago

Ok how do i Verify its built with build kit i have followed docker docks it seems i have to just enable feature flag which i did and build work just fine. but nothing is changed soo can't tell if it worked or not


brody
EMPLOYEE

a year ago

Don't worry about that for now.


brody

One thing to note, since you correctly have the root directory unset, the build is ran from the root of the project, but your Dockerfile copies files in as if the build was ran from within the /apps/platform folder.

brody
EMPLOYEE

a year ago

Please take what I've said here into consideration.


justkira
PROOP

a year ago

Welp i checked everything maybe, im missing something but when i seen logs they are matching (I Think haven't use docker with that many steps tbh) so not sure if there issue with copying /apps/platform , im follow doc of moonrepo i have deployed it before on Contabo VM but not sure where to look at this point.


brody
EMPLOYEE

a year ago

The Dockerfile build is run from the root of the project when on Railway, but your Dockerfile copies files into the image with a relative path as if the build was run from within the /apps/platform folder.

You need to fix this in your Dockerfile.


justkira
PROOP

a year ago

can't i just do this with custom build force root dir in railway
docker build -f ./apps/platform/Dockerfile . like that


brody
EMPLOYEE

a year ago

Not if you are using a shared monorepo.

Please take what I've previously said into consideration and adjust your Dockerfile accordingly.


brody

Not if you are using a shared monorepo.Please take what I've previously said into consideration and adjust your Dockerfile accordingly.

justkira
PROOP

a year ago

i was looking for work around i have created new docker file will test it now


justkira
PROOP

a year ago

Well it seems it stopped working can't find moon.yml folder
I have changed
COPY . .
to
COPY ../../ .
that in theory should fix issue if docker is not running as if its from root but it seems from this test no to was running from root i assume


justkira
PROOP

a year ago

Got it fixed after 22 hours laughing emoji The issue was actually in the Moon repo itself, which I didn't expect. I'm running Windows, and the scripts function a bit differently here, which made the build work even though it doesn't make sense since Docker should be running on Linux. Anyway, I fixed it by adjusting my Moon repo config. Sorry for the hassle!


brody
EMPLOYEE

a year ago

I'm glad you solved it!


Status changed to Solved brody 12 months ago


Loading...