monorepo .next folder not included in docker image
ProjectId: a2ab11df-7f4e-4ea5-8c53-1f345f0fc425
Using Nixpack and turborepo. Build runs fine, but when it runs the start command it logs out
I can tell it to build on the start command again, but half the time that will run into this error:
25 Replies
Is this by chance running off two identical copies of the same codebase?
I have 4 apps running from this code base. 3 are based on nextjs, one is my api. 2/3 of the nextjs apps always fail. The other one will succeed.
Right but they all build on the same push right?
yes
Do I need to split them up into more projects inside of railway?
I'm unsure but the guy who built a lot of that is back from PTO
tomorrow*
Suspect it's a weird concurrency thing?
Okay. I'll wait until tomorrow. Thanks for the update 🙂
Could be. I didn't think about it before but it is weird that only 1/3 of the nextjs apps will build correctly, and it's random which one will.
Oh hmm
These are on start
Why is your application building on start?
It was a workaround that was working for getting around the docker image not including the .next folder
What's the error for this one?
^^
Cause right now you're building on start and that's no bueno
(Regardless of if we fix your issue)
Ya it was a fix to get it deploying, but that workaround isn't working anymore. Site isn't being used by clients yet so I'm not too worried.
Right. What was the error before the workaround.
Is what I'm wondering
So we can fix that
The docker image that gets built is ignoring .next folders in monorepos.
Build stage runs fine, start errors out with directory not found.
Turbo monorepo right? I think that the .next file goes to the root :/
Err, or maybe not?
Any shot you've got a codebase I could test on? Totally fine if not
It goes to the root of the project it is built in.
Right then whys it looking in app/apps/client/.next
Instead of .next in the root :/
Which is probably where that is
Let me change the start command and see if that fixes it.
Pretty sure it stays scoped to the folder it was built in and that's all included in the docker image. Only thing I can really think of is .next folders are in the gitignore, and maybe docker excludes them because of that. I'm not very good with docker so this has me stumped.
it should only ignore dockerignore stuff
Does turbo come with a production webserver even?
Ah the answer is "no"
sec
I logged out each folder's layer after the build is complete and the .next folder is missing. Trying a custom buildpath to see if that fixes it
Setting a custom buildpath in nextconfig works. I changed the folder to be /dist and it runs now. Changing the folder name to be .dist to see if that breaks it.
Huh
Nice 😄
.dist doesn't show when I log out the file structure but it runs.
Not sure what exactly happened or why it's working again. My project ID is at the top if your team ever wants to look into my build history and try to figure it out. Thanks for your time @Cooper! Enjoy your night 🙂
All good and glad you're sorted!
Maybe that engineer will have a look tomorrow lol
Spoke too soon. /.dist doesn't work, but /dist does. Looks like it doesn't like build folders that start with "." Gl with this bug!
Hello, I am available now to take a look at what went wrong.
Just to recap
- It is building and deploying as expected now?
- The issue was that the path was not relative to the current directory?
It is building and deploying now!
Issue seems to be if the folder name starts with "." It is missing even right after building.
Interesting. Thanks for reporting