Containerize monorepo project (NextJS + other apps) powered by Turbo

Many platforms provide plug-and-play options for NextJS deployments.
If you are chasing a containerized solution, this article offers few tips.

Photo by Joakim Honkasalo on Unsplash

Follow turbo’s detailed deploying-with-docker document. One unapparent detail is the issue with the directories of monorepo setups.

This is explained well in Vercel’s Docs.

While tracing in monorepo setups, the project directory is used for tracing by default. For next build packages/web-app, packages/web-app would be the tracing root and any files outside of that folder will not be included. To include files outside of this folder you can set experimental.outputFileTracingRoot in your next.config.js.

Long story short, if you are able to containerize your app but unable to run it, you might be missing the experimental config inside the next.config.js.

Cheers! 🎉