-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (43 loc) · 1.55 KB
/
Dockerfile
File metadata and controls
61 lines (43 loc) · 1.55 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
# Dockerfile — hawk-SecondBrain
# Multi-stage build for hawk-SecondBrain v0.1
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install all dependencies (including devDependencies for build)
RUN npm ci
# Copy source and build
COPY tsconfig.json ./
COPY src ./src
RUN npx tsc
# ============================================================
FROM node:20-alpine
WORKDIR /app
# Security: non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Copy built artifacts
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY package*.json ./
# Copy source for hooks (capture, recall, dream handlers)
COPY src/hooks ./src/hooks
COPY src/skills ./src/skills
COPY src/report ./src/report
COPY src/config.ts ./src/config.ts
COPY src/types.ts ./src/types.ts
COPY src/client.ts ./src/client.ts
# Copy config and scripts
COPY config/ ./config/
COPY scripts/ ./scripts/
# Create hawk data dir
RUN mkdir -p /app/.hawk/reports && chown -R nodejs:nodejs /app
USER nodejs
EXPOSE 3000
ENV NODE_ENV=production
# Health check
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
# Default: run noop server (hooks are invoked by hawk-memory via HTTP callbacks)
# For standalone mode: CMD ["node", "dist/src/index.js"]
CMD ["node", "-e", "console.log('hawk-SecondBrain ready. Hooks invoked via HTTP callbacks from hawk-memory.')"]