Files
hanzoai_agent/control-plane/Dockerfile
zeekay c536f93fd5 feat(cmd/agentd): rename binary, thin entrypoint via pkg/agents.Embed
RENAMED: cmd/hanzo-agents-server/ → cmd/agentd/

Per ~/work/hanzo/HANZO_BINARY.md the canonical name is <svc>d:
tasksd, iamd, kmsd, agentd. Same binary shape across the fleet
so the future fused 'hanzo' binary wires every service through a
single import.

main.go is now ~170 LOC: parse flags+env, agents.Embed(...),
signal handler. Config-loading via cobra/viper has gone — the
canonical contract is EmbedConfig + BootstrapFunc. Bootstrap
plugs in the legacy internal/server/server.NewHanzoAgentsServer
until that lifts into pkg/agents.

ALSO: stripped pre-existing dead references in internal/server:
  - removed unused 'github.com/luxfi/zap' import (no zap symbols
    used; the package was a stub)
  - removed undefined zapAdmin field + startZAPAdminNode call
    (never had a definition; the code was a half-landing)
  - removed undefined registerAdminRESTRoutes call (same)
  - dropped unused 'encoding/json' and pkg/types imports

Net effect: the tree builds cleanly again. 'go build ./...' is
green. The agentd binary builds via 'go build ./cmd/agentd'.

Updated:
  Dockerfile, Makefile, .air.toml, scripts/test-mcp-endpoints.sh,
  tools/perf/README.md — all point at cmd/agentd / 'agentd' now.
2026-04-27 18:51:03 -07:00

59 lines
1.9 KiB
Docker

# Multi-stage build: Node.js frontend + Go backend
# Result: single binary with embedded UI serving on :8080
# ── Stage 1: Build frontend ──────────────────────────────────────
FROM --platform=$BUILDPLATFORM node:22-alpine AS frontend
WORKDIR /app/web/client
COPY web/client/package.json web/client/package-lock.json ./
RUN npm ci --prefer-offline
COPY web/client/ ./
RUN npx vite build
# ── Stage 2: Build Go binary ─────────────────────────────────────
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS backend
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Copy built frontend into the embed location
COPY --from=frontend /app/web/client/dist web/client/dist/
# Build with embedded UI tag
ARG TARGETOS
ARG TARGETARCH
ARG VERSION=dev
ARG COMMIT=none
ARG DATE=unknown
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} go build \
-tags embedded \
-ldflags "-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" \
-o /agentd \
./cmd/agentd
# ── Stage 3: Runtime ─────────────────────────────────────────────
FROM --platform=$TARGETPLATFORM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata
RUN adduser -D -u 1000 hanzo
COPY --from=backend /agentd /usr/local/bin/agentd
# Default config location
RUN mkdir -p /var/hanzo-agents/data /var/hanzo-agents/config /var/hanzo-agents/logs \
&& chown -R hanzo:hanzo /var/hanzo-agents
USER hanzo
WORKDIR /var/hanzo-agents
EXPOSE 8080
HEALTHCHECK --interval=15s --timeout=3s --start-period=5s \
CMD wget -qO- http://localhost:8080/health || exit 1
ENTRYPOINT ["agentd"]