@twelvehart/supermemory-runtime 1.0.0-next.0 → 1.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +120 -0
- package/README.md +35 -3
- package/package.json +2 -1
- package/scripts/check-runtime-pack.ts +1 -1
package/Dockerfile
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# SuperMemory Clone API - Multi-stage Dockerfile
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# This Dockerfile uses a multi-stage build for optimal image size:
|
|
5
|
+
# - Stage 1 (deps): Install all dependencies
|
|
6
|
+
# - Stage 2 (builder): Build TypeScript to JavaScript
|
|
7
|
+
# - Stage 3 (runner): Production runtime with minimal footprint
|
|
8
|
+
# =============================================================================
|
|
9
|
+
|
|
10
|
+
# -----------------------------------------------------------------------------
|
|
11
|
+
# Stage 1: Dependencies
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
|
+
# Install all dependencies including devDependencies for building
|
|
14
|
+
FROM node:20-alpine AS deps
|
|
15
|
+
|
|
16
|
+
# Install build dependencies required for native modules (better-sqlite3)
|
|
17
|
+
# - python3 and make are needed for node-gyp
|
|
18
|
+
# - g++ is the C++ compiler
|
|
19
|
+
# - libc6-compat ensures glibc compatibility
|
|
20
|
+
RUN apk add --no-cache python3 make g++ libc6-compat
|
|
21
|
+
|
|
22
|
+
WORKDIR /app
|
|
23
|
+
|
|
24
|
+
# Copy package files for dependency installation
|
|
25
|
+
# This layer is cached unless package*.json changes
|
|
26
|
+
COPY package.json package-lock.json ./
|
|
27
|
+
|
|
28
|
+
# Install all dependencies (including dev for TypeScript compilation)
|
|
29
|
+
# Use --legacy-peer-deps if you encounter peer dependency issues
|
|
30
|
+
RUN npm ci
|
|
31
|
+
|
|
32
|
+
# -----------------------------------------------------------------------------
|
|
33
|
+
# Stage 2: Builder
|
|
34
|
+
# -----------------------------------------------------------------------------
|
|
35
|
+
# Compile TypeScript to JavaScript
|
|
36
|
+
FROM node:20-alpine AS builder
|
|
37
|
+
|
|
38
|
+
WORKDIR /app
|
|
39
|
+
|
|
40
|
+
# Copy dependencies from deps stage
|
|
41
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
42
|
+
|
|
43
|
+
# Copy source code and configuration files
|
|
44
|
+
COPY package.json package-lock.json tsconfig.json ./
|
|
45
|
+
COPY src ./src
|
|
46
|
+
COPY drizzle.config.ts ./
|
|
47
|
+
|
|
48
|
+
# Build TypeScript
|
|
49
|
+
RUN npm run build
|
|
50
|
+
|
|
51
|
+
# Generate drizzle migrations if schema exists
|
|
52
|
+
# This ensures migrations are available in production
|
|
53
|
+
RUN npm run db:generate || true
|
|
54
|
+
|
|
55
|
+
# Prune dev dependencies for production
|
|
56
|
+
# This removes TypeScript, test frameworks, etc.
|
|
57
|
+
RUN npm prune --production
|
|
58
|
+
|
|
59
|
+
# -----------------------------------------------------------------------------
|
|
60
|
+
# Stage 3: Production Runner
|
|
61
|
+
# -----------------------------------------------------------------------------
|
|
62
|
+
# Minimal production image
|
|
63
|
+
FROM node:20-alpine AS runner
|
|
64
|
+
|
|
65
|
+
# Add labels for container metadata
|
|
66
|
+
LABEL org.opencontainers.image.title="SuperMemory Clone API"
|
|
67
|
+
LABEL org.opencontainers.image.description="Personal AI memory assistant with semantic search"
|
|
68
|
+
LABEL org.opencontainers.image.version="1.0.0"
|
|
69
|
+
LABEL org.opencontainers.image.vendor="SuperMemory Clone"
|
|
70
|
+
|
|
71
|
+
# Install runtime dependencies only
|
|
72
|
+
# - libc6-compat: Required for better-sqlite3 native bindings
|
|
73
|
+
# - tini: Proper init system for signal handling in containers
|
|
74
|
+
RUN apk add --no-cache libc6-compat tini
|
|
75
|
+
|
|
76
|
+
# Create non-root user for security
|
|
77
|
+
# Running as root in containers is a security risk
|
|
78
|
+
RUN addgroup --system --gid 1001 nodejs && \
|
|
79
|
+
adduser --system --uid 1001 supermemory
|
|
80
|
+
|
|
81
|
+
WORKDIR /app
|
|
82
|
+
|
|
83
|
+
# Create data directory for SQLite database
|
|
84
|
+
# This directory should be mounted as a volume in production
|
|
85
|
+
RUN mkdir -p /app/data && chown -R supermemory:nodejs /app/data
|
|
86
|
+
|
|
87
|
+
# Copy production files from builder
|
|
88
|
+
COPY --from=builder --chown=supermemory:nodejs /app/node_modules ./node_modules
|
|
89
|
+
COPY --from=builder --chown=supermemory:nodejs /app/dist ./dist
|
|
90
|
+
COPY --from=builder --chown=supermemory:nodejs /app/package.json ./
|
|
91
|
+
COPY --from=builder --chown=supermemory:nodejs /app/drizzle ./drizzle
|
|
92
|
+
|
|
93
|
+
# Copy entrypoint script
|
|
94
|
+
COPY --chown=supermemory:nodejs scripts/docker-entrypoint.sh /app/docker-entrypoint.sh
|
|
95
|
+
RUN chmod +x /app/docker-entrypoint.sh
|
|
96
|
+
|
|
97
|
+
# Switch to non-root user
|
|
98
|
+
USER supermemory
|
|
99
|
+
|
|
100
|
+
# Set environment variables
|
|
101
|
+
# NODE_ENV=production enables production optimizations
|
|
102
|
+
ENV NODE_ENV=production
|
|
103
|
+
ENV API_HOST=0.0.0.0
|
|
104
|
+
ENV API_PORT=3000
|
|
105
|
+
|
|
106
|
+
# Expose API port
|
|
107
|
+
EXPOSE 3000
|
|
108
|
+
|
|
109
|
+
# Health check to verify the container is running properly
|
|
110
|
+
# Checks the /health endpoint every 30 seconds
|
|
111
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
112
|
+
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
|
|
113
|
+
|
|
114
|
+
# Use tini as init system for proper signal handling
|
|
115
|
+
# This ensures SIGTERM is properly forwarded to Node.js
|
|
116
|
+
ENTRYPOINT ["/sbin/tini", "--"]
|
|
117
|
+
|
|
118
|
+
# Run with node directly (not npm) for proper signal handling
|
|
119
|
+
# npm doesn't forward signals properly to child processes
|
|
120
|
+
CMD ["/app/docker-entrypoint.sh"]
|
package/README.md
CHANGED
|
@@ -33,12 +33,12 @@ It stores documents, extracts memories, indexes embeddings, and serves search/pr
|
|
|
33
33
|
Primary path for first-time users:
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
npx -y @twelvehart/supermemory@latest full --
|
|
37
|
-
cd
|
|
36
|
+
npx -y @twelvehart/supermemory@latest full --mcp project
|
|
37
|
+
cd ~/.supermemory
|
|
38
38
|
claude
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
That command unpacks the runtime into
|
|
41
|
+
That command unpacks the runtime into `~/.supermemory`, runs the canonical `scripts/install.sh` from the final directory, registers Claude MCP against that final path, and prints only the next steps a new user can actually take.
|
|
42
42
|
|
|
43
43
|
The npx installer supports:
|
|
44
44
|
|
|
@@ -331,6 +331,38 @@ claude mcp get supermemory
|
|
|
331
331
|
- `npm run pack:check:runtime` - Verify the runtime npm tarball contents
|
|
332
332
|
- `npm run validate` - typecheck + lint + format + tests
|
|
333
333
|
|
|
334
|
+
## Claude Sandbox VM
|
|
335
|
+
|
|
336
|
+
For isolated Claude Code and plugin testing on macOS/Linux hosts, use Multipass with the bundled sandbox scripts.
|
|
337
|
+
|
|
338
|
+
Host prerequisite: install Multipass on the host. On macOS, for example:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
brew install --cask multipass
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Create and provision a reusable Ubuntu VM with Docker, Node/npm, uv, Claude Code, and common CLI tools:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
./scripts/claude-sandbox-vm.sh create --mount "$PWD:/home/ubuntu/workspace/repo"
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Common operations:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
./scripts/claude-sandbox-vm.sh info
|
|
354
|
+
./scripts/claude-sandbox-vm.sh shell
|
|
355
|
+
./scripts/claude-sandbox-vm.sh exec -- claude --version
|
|
356
|
+
./scripts/claude-sandbox-vm.sh provision
|
|
357
|
+
./scripts/claude-sandbox-vm.sh delete
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Notes:
|
|
361
|
+
|
|
362
|
+
- The VM installs Claude Code from npm but does not authenticate it for you; run `claude login` inside the VM.
|
|
363
|
+
- Docker group membership is added during provisioning; reconnect or run `exec newgrp docker` before using Docker.
|
|
364
|
+
- Override defaults with env vars such as `CLAUDE_SANDBOX_VM_NAME`, `CLAUDE_SANDBOX_MEMORY`, `NODE_MAJOR`, and `CLAUDE_NPM_PACKAGE`.
|
|
365
|
+
|
|
334
366
|
## Testing
|
|
335
367
|
|
|
336
368
|
- Unit/integration tests: `vitest`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twelvehart/supermemory-runtime",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.2",
|
|
4
4
|
"description": "A personal AI memory assistant - supermemory.ai clone",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"README.md",
|
|
10
10
|
".env.example",
|
|
11
|
+
"Dockerfile",
|
|
11
12
|
"package-lock.json",
|
|
12
13
|
"src",
|
|
13
14
|
"scripts",
|
|
@@ -14,6 +14,7 @@ interface PackResult {
|
|
|
14
14
|
|
|
15
15
|
const REQUIRED_PATHS = [
|
|
16
16
|
'.env.example',
|
|
17
|
+
'Dockerfile',
|
|
17
18
|
'docker-compose.prod.yml',
|
|
18
19
|
'docker-compose.yml',
|
|
19
20
|
'package.json',
|
|
@@ -30,7 +31,6 @@ const REQUIRED_PATHS = [
|
|
|
30
31
|
const FORBIDDEN_PATTERNS = [
|
|
31
32
|
/^coverage\//,
|
|
32
33
|
/^data\//,
|
|
33
|
-
/^dist\//,
|
|
34
34
|
/^packages\//,
|
|
35
35
|
/^tests\//,
|
|
36
36
|
/^2026-03-05-npx-first-installer-/,
|