Next.js Discord

Discord Forum

Building standalone in monorepo

Unanswered
Willow shoot sawfly posted this in #help-forum
Open in Discord
Willow shoot sawflyOP
Hello, I am trying to set up my Dockerfile using this example https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile, I've had to make some changes to the paths since we are using a monorepo with several apps, so all files for the app I am trying to build are in /apps/admin for example. I've managed to get it to build successfully now, however when trying to run the server.js file I noticed it wasn't were the Dockerfile expected it to be.
In a simple app created with create-next-app the .next/standalone folder will include the server.js, a package.json, node_modules, and a second .next folder, however in my monorepo the .next/standalone folder will include node_modules, the root package.json (not the apps), and a folder called "apps" which in turn contains a "admin" folder with my server.js.

I could easily change the path so the Dockerfile finds the server.js file, however it seems like the package.json file is wrong since its the root package.json which only contains packages related to eslint, and my yarn workspaces configuration, and not the actual app dependencies.

Is there anything I need to do differently due to using a monorepo?

0 Replies