Turborepo, Docker and multiple Nextjs Apps.
Hi guys, i need some help, i have a monorepo (turborepo) of nextjs proyects, and they have a lot of common dependencies like react, next, etc. So i'm trying to dockerize my monorepo, and trying to 1 only install common dependencies once and 2 trying to reduce the final image size of each service, i already try it nextjs standalone and fail 😦 . Anyone know how to fix this?
2 Replies
This is a Dockerfile that I used for several nextjs apps within a single turborepo. The way to reduce image size is by using layers and having a "runner" that only copies the relevant things needed for actually running the app.
This particular Dockerfile worked for me 7 months ago. I have not touched turborepo since then unfortunately and Im pretty sure turborepo have changed since then but hopyfully this gets you going!
Thanks