From 7ee08865fd9e3e4e9ef063b61e0215a4cb5c0de3 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Sun, 1 Feb 2026 00:37:34 -0600 Subject: [PATCH] fix(docker): Use TurboRepo to build workspace dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Docker builds were failing because they ran `pnpm build` directly in the app directories without first building workspace dependencies (@mosaic/shared, @mosaic/ui). CI passed because it runs TurboRepo from the root which respects the dependency graph. Changed both Dockerfiles to use `pnpm turbo build --filter=@mosaic/{app}` which ensures dependencies are built in the correct order: - Web: @mosaic/config → @mosaic/shared → @mosaic/ui → @mosaic/web - API: @mosaic/config → @mosaic/shared → prisma:generate → @mosaic/api Co-Authored-By: Claude Opus 4.5 --- apps/api/Dockerfile | 11 +++-------- apps/web/Dockerfile | 8 +++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 19995b6..06f5417 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -39,14 +39,9 @@ COPY --from=deps /app/apps/api/node_modules ./apps/api/node_modules COPY packages ./packages COPY apps/api ./apps/api -# Set working directory to API app -WORKDIR /app/apps/api - -# Generate Prisma client -RUN pnpm prisma:generate - -# Build the application -RUN pnpm build +# Build the API app and its dependencies using TurboRepo +# This ensures @mosaic/shared is built first, then prisma:generate, then the API +RUN pnpm turbo build --filter=@mosaic/api # ====================== # Production stage diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 8b8b9c2..71fd794 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -39,15 +39,13 @@ COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules COPY packages ./packages COPY apps/web ./apps/web -# Set working directory to web app -WORKDIR /app/apps/web - # Build arguments for Next.js ARG NEXT_PUBLIC_API_URL ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} -# Build the application -RUN pnpm build +# Build the web app and its dependencies using TurboRepo +# This ensures @mosaic/shared and @mosaic/ui are built first +RUN pnpm turbo build --filter=@mosaic/web # ====================== # Production stage