-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
90 lines (69 loc) · 2.3 KB
/
Copy pathDockerfile
File metadata and controls
90 lines (69 loc) · 2.3 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Context-Simplo Docker image
# Multi-stage build for optimized production image
FROM node:22-slim AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy root package files
COPY package*.json ./
# Install root dependencies (HUSKY=0 skips git hook setup in Docker)
RUN HUSKY=0 npm ci --legacy-peer-deps
# Copy source and build backend
COPY tsconfig*.json ./
COPY src ./src
RUN npm run build
# Copy SQL migration files (not copied by TypeScript compiler)
RUN mkdir -p dist/store/migrations
COPY src/store/migrations/*.sql dist/store/migrations/
# Copy WASM grammar files for AST engine
RUN mkdir -p dist/core/ast/grammars
COPY src/core/ast/grammars/*.wasm dist/core/ast/grammars/
# Remove devDependencies to slim down the production image
RUN npm prune --omit=dev --legacy-peer-deps
# Dashboard stage — isolated to avoid esbuild version conflicts with root
FROM node:22-slim AS dashboard-builder
WORKDIR /dashboard
COPY dashboard/package.json ./
RUN npm install --no-package-lock
COPY dashboard/ ./
RUN npm run build
# Production stage
FROM node:22-slim
# Install runtime dependencies.
# `git` is required at runtime by simple-git for the EML diff observer and
# git-authorship ingestion; without it those features silently no-op.
RUN apt-get update && apt-get install -y \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built files from builder
COPY --from=builder /app/dist ./dist
COPY --from=dashboard-builder /dashboard/dist ./dashboard/dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
COPY .contextignore.default ./
# Copy MCP template files
COPY templates ./templates
# Create data, workspace, and host mount directories
RUN mkdir -p /data /workspace /host
# Set environment variables
ENV NODE_ENV=production
ENV DATA_DIR=/data
ENV WORKSPACE_ROOT=/workspace
ENV MOUNT_ROOT=/host
ENV NODE_OPTIONS="--max-old-space-size=2560 --expose-gc"
# Expose port
EXPOSE 3001
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
CMD curl -f http://localhost:3001/api/health || exit 1
# Volume mounts
VOLUME ["/workspace", "/host", "/data"]
# Run the application
CMD ["node", "dist/index.js"]