-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (49 loc) · 2.44 KB
/
Dockerfile
File metadata and controls
64 lines (49 loc) · 2.44 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
# ══════════════════════════════════════════════════════════════
# Auto-Heal Locators — Dashboard Server
# ──────────────────────────────────────────────────────────────
# Multi-stage build: compile TS → run compiled JS
#
# Usage:
# docker build -t auto-heal-dashboard .
# docker run -p 4040:4040 -v ./data:/data auto-heal-dashboard
#
# Or with docker-compose:
# docker compose up -d
# ══════════════════════════════════════════════════════════════
# ── Stage 1: Build ────────────────────────────────────────────
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files and install dependencies
COPY package.json tsconfig.json ./
RUN npm install
# Copy source and compile
COPY src/ ./src/
COPY types/ ./types/
RUN npm run build
# ── Stage 2: Runtime ──────────────────────────────────────────
FROM node:20-alpine
LABEL maintainer="auto-heal-locators"
LABEL description="Auto-Heal Locators Dashboard Server with real-time WebSocket updates"
WORKDIR /app
# Copy compiled output only (no source, no devDeps)
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./
# Create data directory for persistence
RUN mkdir -p /data/reports && \
chown -R node:node /data
# Use non-root user
USER node
# Environment defaults
ENV NODE_ENV=production \
AUTO_HEAL_HISTORY_PATH=/data/history.json \
AUTO_HEAL_REPORT_DIR=/data/reports \
AUTO_HEAL_DASHBOARD_PORT=4040
# Expose dashboard port
EXPOSE 4040
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD node -e "const http = require('http'); const req = http.get('http://localhost:4040/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1); }); req.on('error', () => process.exit(1)); req.setTimeout(3000, () => { req.destroy(); process.exit(1); });"
# Persistent data volume
VOLUME ["/data"]
# Start dashboard server
CMD ["node", "dist/cli/index.js", "dashboard", "--port", "4040"]