diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..94b7fa2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,58 @@ +# Dependencies (installed fresh in Docker) +node_modules +**/node_modules + +# Build outputs (built fresh in Docker) +dist +**/dist +.next +**/.next + +# TurboRepo cache +.turbo +**/.turbo + +# IDE +.idea +.vscode +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Environment files +.env +.env.* +!.env.example + +# Credentials +.admin-credentials + +# Testing +coverage +**/coverage + +# Logs +*.log + +# Misc +*.tsbuildinfo +**/*.tsbuildinfo +.pnpm-approve-builds +.husky/_ + +# Git +.git +.gitignore + +# Docker +Dockerfile* +docker-compose*.yml +.dockerignore + +# Documentation (not needed in container) +docs +*.md +!README.md diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 6c6c4e5..5285f38 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -46,11 +46,25 @@ COPY --from=deps /app/packages/shared/node_modules ./packages/shared/node_module COPY --from=deps /app/packages/config/node_modules ./packages/config/node_modules COPY --from=deps /app/apps/api/node_modules ./apps/api/node_modules +# Debug: Show what we have before building +RUN echo "=== Pre-build directory structure ===" && \ + echo "--- packages/config/typescript ---" && ls -la packages/config/typescript/ && \ + echo "--- packages/shared (top level) ---" && ls -la packages/shared/ && \ + echo "--- packages/shared/src ---" && ls -la packages/shared/src/ && \ + echo "--- apps/api (top level) ---" && ls -la apps/api/ && \ + echo "--- apps/api/src (exists?) ---" && ls apps/api/src/*.ts | head -5 && \ + echo "--- node_modules/@mosaic (symlinks?) ---" && ls -la node_modules/@mosaic/ 2>/dev/null || echo "No @mosaic in node_modules" + # Build the API app and its dependencies using TurboRepo # This ensures @mosaic/shared is built first, then prisma:generate, then the API -# Cache TurboRepo build outputs for faster subsequent builds -RUN --mount=type=cache,id=turbo-cache,target=/app/.turbo \ - pnpm turbo build --filter=@mosaic/api +# Disable turbo cache temporarily to ensure fresh build and see full output +RUN pnpm turbo build --filter=@mosaic/api --force --verbosity=2 + +# Debug: Show what was built +RUN echo "=== Post-build directory structure ===" && \ + echo "--- packages/shared/dist ---" && ls -la packages/shared/dist/ 2>/dev/null || echo "NO dist in shared" && \ + echo "--- apps/api/dist ---" && ls -la apps/api/dist/ 2>/dev/null || echo "NO dist in api" && \ + echo "--- apps/api/dist contents (if exists) ---" && find apps/api/dist -type f 2>/dev/null | head -10 || echo "Cannot find dist files" # ====================== # Production stage diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 743036e..b4b3f58 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -51,11 +51,23 @@ COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules ARG NEXT_PUBLIC_API_URL ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} +# Debug: Show what we have before building +RUN echo "=== Pre-build directory structure ===" && \ + echo "--- packages/config/typescript ---" && ls -la packages/config/typescript/ && \ + echo "--- packages/shared (top level) ---" && ls -la packages/shared/ && \ + echo "--- packages/ui (top level) ---" && ls -la packages/ui/ && \ + echo "--- apps/web (top level) ---" && ls -la apps/web/ + # Build the web app and its dependencies using TurboRepo # This ensures @mosaic/shared and @mosaic/ui are built first -# Cache TurboRepo build outputs for faster subsequent builds -RUN --mount=type=cache,id=turbo-cache,target=/app/.turbo \ - pnpm turbo build --filter=@mosaic/web +# Disable turbo cache temporarily to ensure fresh build +RUN pnpm turbo build --filter=@mosaic/web --force + +# Debug: Show what was built +RUN echo "=== Post-build directory structure ===" && \ + echo "--- packages/shared/dist ---" && ls -la packages/shared/dist/ 2>/dev/null || echo "NO dist in shared" && \ + echo "--- packages/ui/dist ---" && ls -la packages/ui/dist/ 2>/dev/null || echo "NO dist in ui" && \ + echo "--- apps/web/.next ---" && ls -la apps/web/.next/ 2>/dev/null || echo "NO .next in web" # Ensure public directory exists (may be empty) RUN mkdir -p ./apps/web/public