diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b0bfd10 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,62 @@ +# Dependencies +node_modules +.pnpm-store + +# Build outputs +**/dist +**/build +**/.next +**/.nuxt + +# Testing +**/__tests__ +**/*.test.ts +**/*.test.js +**/*.spec.ts +**/*.spec.js +**/coverage +**/.vitest + +# Environment files (should be injected at runtime) +**/.env +**/.env.* +!**/.env.example + +# Development files +**/*.log +**/.DS_Store +**/npm-debug.log* +**/yarn-debug.log* +**/yarn-error.log* +**/pnpm-debug.log* + +# IDE +**/.idea +**/.vscode +**/.vs +**/*.swp +**/*.swo +**/*~ + +# Git +.git +.gitignore +.gitattributes + +# Documentation (not needed in production image) +**/*.md +!**/README.md + +# CI/CD +.github +**/.gitlab-ci.yml +**/cloudbuild.yaml +**/.circleci + +# Misc +**/.turbo +**/tsconfig.tsbuildinfo +**/.cache +**/tmp +**/temp + diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index a725a45..bd5019a 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -61,13 +61,17 @@ RUN pnpm install --frozen-lockfile --prod && pnpm store prune # ============================================================================== FROM base AS staging -# Copy production dependencies (from workspace root) -COPY --from=prod-deps /app/node_modules ./node_modules - # Copy built api application COPY --from=build /app/apps/api/dist ./apps/api/dist COPY --from=build /app/apps/api/package.json ./apps/api/package.json +# Copy shared packages (needed for workspace resolution) +COPY --from=prod-deps /app/packages ./packages + +# Install production dependencies +# This ensures proper symlink structure for pnpm +RUN pnpm install --frozen-lockfile --prod --filter @xtablo/api... + # Set working directory to api app WORKDIR /app/apps/api @@ -93,13 +97,17 @@ CMD ["pnpm", "start"] # ============================================================================== FROM base AS production -# Copy production dependencies (from workspace root) -COPY --from=prod-deps /app/node_modules ./node_modules - # Copy built api application COPY --from=build /app/apps/api/dist ./apps/api/dist COPY --from=build /app/apps/api/package.json ./apps/api/package.json +# Copy shared packages (needed for workspace resolution) +COPY --from=prod-deps /app/packages ./packages + +# Install production dependencies +# This ensures proper symlink structure for pnpm +RUN pnpm install --frozen-lockfile --prod --filter @xtablo/api... + # Set working directory to api app WORKDIR /app/apps/api diff --git a/apps/api/tsconfig.json b/apps/api/tsconfig.json index a1ac90f..42a2da2 100644 --- a/apps/api/tsconfig.json +++ b/apps/api/tsconfig.json @@ -4,6 +4,7 @@ "skipLibCheck": true, "target": "es2022", "module": "NodeNext", + "rootDir": "./src", "outDir": "./dist", "allowJs": true, "moduleDetection": "force", @@ -11,5 +12,6 @@ "verbatimModuleSyntax": true, "types": ["node"] }, + "include": ["src/**/*"], "exclude": ["node_modules", "dist"] }