# Generated by https://smithery.ai. See: https://smithery.ai/docs/build/project-config
# Build stage
FROM node:lts-alpine AS builder
# Install build dependencies
RUN apk add --no-cache python3 make g++ git
WORKDIR /app
# Copy package files and install dependencies including dev and build
COPY package.json package-lock.json ./
RUN npm install
# Copy rest of the source
COPY . .
# Build the server (builds dist and includes prebuilt hnswlib-node into dist/node_modules)
RUN npm run build
# Runtime stage
FROM node:lts-alpine AS runner
WORKDIR /app
# Copy application code and dependencies from builder
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
# Copy data directory if it exists (contains pre-indexed documentation)
COPY --from=builder /app/data ./data
# Default command supplied by MCP
CMD ["node", "dist/mcp-server.js"]