refactor(infra): server-side SVG dashboard with Go
- Replace nginx+Chart.js client-side dashboard with Go server - Server-side rendered SVG charts (donut, line charts) - Direct Docker socket integration via Go stdlib - Embedded HTML template via //go:embed - Minimal scratch image (~9MB total) - Remove nginx.conf and client-side Chart.js
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
FROM nginx:alpine
|
||||
# Replace default nginx.conf with our custom config (runs as root for Docker socket access)
|
||||
COPY infra/dashboard/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY infra/dashboard/index.html /usr/share/nginx/html/index.html
|
||||
# ── Build stage ──
|
||||
FROM golang:1.24-alpine AS builder
|
||||
WORKDIR /build
|
||||
COPY infra/dashboard/ ./
|
||||
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o dashboard .
|
||||
|
||||
# ── Runtime (scratch — ~7MB total) ──
|
||||
FROM scratch
|
||||
COPY --from=builder /build/dashboard /dashboard
|
||||
EXPOSE 8080
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
CMD ["/dashboard"]
|
||||
|
||||
Reference in New Issue
Block a user