-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (35 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
48 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ── Stage 1: Build ──
FROM node:20-slim AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install all dependencies (including devDependencies for build)
RUN npm ci
# Copy source and config
COPY tsconfig.json ./
COPY src/ ./src/
COPY scripts/ ./scripts/
# Build (compile TS, copy schema.sql, add shebang)
RUN node scripts/build.js
# Populate the database
RUN node dist/scrapers/scrape-modules.js
# ── Stage 2: Production ──
FROM node:20-slim AS runtime
WORKDIR /app
# Install only production deps (better-sqlite3 needs rebuild on linux)
COPY package*.json ./
RUN npm ci --omit=dev && npm cache clean --force
# Copy compiled code and pre-built database from builder
COPY --from=builder /app/dist/ ./dist/
COPY --from=builder /app/data/ ./data/
COPY --from=builder /app/src/database/schema.sql ./src/database/schema.sql
COPY bin/ ./bin/
# Non-root user for security
RUN addgroup --system mcp && adduser --system --ingroup mcp mcp
RUN chown -R mcp:mcp /app
USER mcp
# Environment defaults
ENV LOG_LEVEL=error
ENV NODE_ENV=production
# Entry point — stdio transport for MCP
ENTRYPOINT ["node", "dist/mcp/server.js"]