mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 23:01:09 +02:00
Central search microservice for all ManaCore apps featuring: - NestJS API on port 3021 - SearXNG meta-search engine integration (40+ search engines) - Redis caching layer for search results and extracted content - Content extraction with markdown conversion - Prometheus metrics for monitoring API Endpoints: - POST /api/v1/search - Web search with categories/engines - POST /api/v1/extract - Content extraction from URLs - POST /api/v1/extract/bulk - Bulk extraction - GET /health - Health check - GET /metrics - Prometheus metrics Search categories: general, news, science, it, images, videos Supported engines: Google, Bing, DuckDuckGo, Wikipedia, arXiv, GitHub, StackOverflow, and many more. https://claude.ai/code/session_01Rk3YVJCU3nM8uvVPghRz6r
60 lines
1.2 KiB
Docker
60 lines
1.2 KiB
Docker
# ================================
|
|
# Build Stage
|
|
# ================================
|
|
FROM node:20-slim AS builder
|
|
|
|
# Install pnpm
|
|
RUN npm install -g pnpm@9.15.0
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json pnpm-lock.yaml* ./
|
|
|
|
# Install dependencies
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy source code
|
|
COPY tsconfig.json nest-cli.json ./
|
|
COPY src ./src
|
|
|
|
# Build the application
|
|
RUN pnpm build
|
|
|
|
# ================================
|
|
# Production Stage
|
|
# ================================
|
|
FROM node:20-slim AS production
|
|
|
|
# Install pnpm
|
|
RUN npm install -g pnpm@9.15.0
|
|
|
|
# Create non-root user
|
|
RUN groupadd -r nestjs && useradd -r -g nestjs nestjs
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json pnpm-lock.yaml* ./
|
|
|
|
# Install production dependencies only
|
|
RUN pnpm install --prod --frozen-lockfile
|
|
|
|
# Copy built application
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
# Set ownership
|
|
RUN chown -R nestjs:nestjs /app
|
|
|
|
# Switch to non-root user
|
|
USER nestjs
|
|
|
|
# Expose port
|
|
EXPOSE 3021
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD node -e "fetch('http://localhost:3021/health').then(r => r.ok ? process.exit(0) : process.exit(1)).catch(() => process.exit(1))"
|
|
|
|
# Start the application
|
|
CMD ["node", "dist/main"]
|