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:
asepharyana
2026-07-22 18:35:29 +07:00
parent 9f54f90621
commit afae724f6b
6 changed files with 769 additions and 787 deletions
+10 -5
View File
@@ -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"]