-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 1.32 KB
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 1.32 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
# ---- Builder Stage ----
FROM node:24-alpine AS builder
# Install build tools required for native modules (e.g. re2)
RUN apk add --no-cache python3 make g++
WORKDIR /app
# Install dependencies first (layer caching)
# --ignore-scripts avoids triggering `prepare` (build) before source is copied
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts && npm rebuild
# Copy source and build
COPY src/ ./src/
COPY tsconfig.json tsconfig.build.json ./
COPY scripts/ ./scripts/
RUN npm run build
# Remove dev dependencies (keep pre-compiled native modules)
RUN npm prune --production
# ---- Release Stage ----
FROM node:24-alpine
ENV NODE_ENV=production
# Labels for Docker / MCP Catalog
LABEL org.opencontainers.image.title="Code Lens" \
org.opencontainers.image.description="Gemini-powered MCP server for code analysis." \
org.opencontainers.image.source="https://github.com/j0hanz/code-lens" \
org.opencontainers.image.licenses="MIT" \
io.modelcontextprotocol.server.name="io.github.j0hanz/code-lens"
# Create non-root user
RUN adduser -D mcp
WORKDIR /app
# Copy built artifacts and pre-compiled dependencies from builder
COPY --from=builder /app/dist ./dist/
COPY --from=builder /app/node_modules ./node_modules/
COPY --from=builder /app/package.json ./
USER mcp
ENTRYPOINT ["node", "dist/index.js"]