b85eae5a79
Moves AgentsView to Go 1.27 and adopts native `encoding/json/v2` behavior throughout. This is a clean migration with no JSON v1 compatibility or checkpoint fallback paths. Typed Huma routes now share JSON v2 request and response semantics with the rest of the application. OpenAPI continues to describe token usage as arbitrary JSON. JSONL rewrite paths retain untouched values as raw JSON, so large integers stay exact, while stored map output is deterministic where bytes define artifact identity. The Go 1.27 audit also adopts generic methods, assignment-context inference, promoted fields in struct literals, `errors.AsType`, and related standard-library simplifications. Build images, local tooling, documentation, and reviewer guidance now require Go 1.27. golangci-lint is pinned to v2.13.0, which can analyze the new language level.
74 lines
2.3 KiB
Docker
74 lines
2.3 KiB
Docker
FROM --platform=$BUILDPLATFORM node:24-bookworm AS frontend-build
|
|
|
|
WORKDIR /src/frontend
|
|
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
|
|
# @kenn-io/kit-ui is a commit-pinned git dependency
|
|
# (github:kenn-io/kit-ui#<commit> in frontend/package.json); the repository
|
|
# is public, so npm clones it anonymously over HTTPS (git ships in the
|
|
# node:bookworm image).
|
|
RUN npm ci
|
|
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
FROM golang:1.27.0-bookworm AS build
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends build-essential ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /src
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# sqlite-vec's cgo bindings (pulled in via go.kenn.io/kit/vector/sqlitevec)
|
|
# #include "sqlite3.h", which this image does not ship. Compile them against
|
|
# the header of the exact SQLite amalgamation that mattn/go-sqlite3 bundles
|
|
# and statically links, so header and linked library always match.
|
|
# "-O2 -g" restates Go's built-in default, which setting CGO_CFLAGS would
|
|
# otherwise replace, leaving the SQLite amalgamation unoptimized (2-3x
|
|
# slower queries).
|
|
RUN mkdir -p /sqlite-include \
|
|
&& cp "$(go list -m -f '{{.Dir}}' github.com/mattn/go-sqlite3)/sqlite3-binding.h" /sqlite-include/sqlite3.h
|
|
ENV CGO_CFLAGS="-O2 -g -I/sqlite-include"
|
|
|
|
COPY . ./
|
|
COPY --from=frontend-build /src/frontend/dist ./internal/web/dist
|
|
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
ARG VERSION=dev
|
|
ARG COMMIT=unknown
|
|
ARG BUILD_DATE=
|
|
|
|
RUN go run ./internal/pricing/cmd/litellm-snapshot -restore
|
|
|
|
RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
|
go build -tags fts5 -trimpath -buildvcs=false \
|
|
-ldflags "-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.buildDate=${BUILD_DATE}" \
|
|
-o /out/agentsview ./cmd/agentsview
|
|
|
|
RUN /out/agentsview --version
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& mkdir -p /data /agents
|
|
|
|
ENV AGENTSVIEW_DATA_DIR=/data
|
|
|
|
COPY --from=build /out/agentsview /usr/local/bin/agentsview
|
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
|
|
RUN chmod +x /usr/local/bin/agentsview /usr/local/bin/docker-entrypoint.sh
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
CMD ["--host", "0.0.0.0", "--no-browser"]
|