mirror of
https://github.com/hanzoai/agents.git
synced 2026-10-30 18:48:36 +00:00
The golang images ship GOTOOLCHAIN=local, so the image's Go is the authority and a newer directive is refused rather than satisfied: go: go.mod requires go >= 1.26.4 (running go 1.26.3; GOTOOLCHAIN=local) The control-plane image has not built since that bump. GOTOOLCHAIN=auto makes control-plane/go.mod the one place the version lives and the base tag a floor.
55 lines
2.2 KiB
Docker
55 lines
2.2 KiB
Docker
FROM --platform=$BUILDPLATFORM node:20-alpine AS ui-builder
|
|
WORKDIR /app/web
|
|
|
|
COPY control-plane/web/client/package*.json ./
|
|
RUN npm ci
|
|
COPY control-plane/web/client/ .
|
|
RUN npm run build
|
|
|
|
FROM --platform=$BUILDPLATFORM golang:1.26.3-bookworm AS go-builder
|
|
WORKDIR /app
|
|
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
ENV CGO_ENABLED=1
|
|
# The golang images ship GOTOOLCHAIN=local, which makes the image's Go the
|
|
# authority and refuses a newer go directive outright:
|
|
# go: go.mod requires go >= 1.26.4 (running go 1.26.3; GOTOOLCHAIN=local)
|
|
# That is two places holding the version, and they drift silently. `auto` makes
|
|
# control-plane/go.mod the single source of truth and this tag a floor.
|
|
ENV GOTOOLCHAIN=auto
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
pkg-config \
|
|
gcc-aarch64-linux-gnu \
|
|
libc6-dev-arm64-cross \
|
|
gcc-x86-64-linux-gnu \
|
|
libc6-dev-amd64-cross \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY control-plane/go.mod control-plane/go.sum ./control-plane/
|
|
RUN cd control-plane && go mod download
|
|
|
|
COPY control-plane/ ./control-plane/
|
|
COPY --from=ui-builder /app/web/dist ./control-plane/web/client/dist
|
|
|
|
RUN cd control-plane && \
|
|
if [ "${TARGETARCH}" = "arm64" ]; then export CC=aarch64-linux-gnu-gcc; elif [ "${TARGETARCH}" = "amd64" ]; then export CC=x86_64-linux-gnu-gcc; else export CC=gcc; fi && \
|
|
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -tags "embedded sqlite_fts5" -o /app/bin/hanzo-agents-server ./cmd/hanzo-agents-server
|
|
|
|
# Pre-create writable data directory for distroless runtime. The nonroot user
|
|
# has UID/GID 65532 in the base image, so match that here.
|
|
RUN mkdir -p /tmp/hanzo-agents-data && chown 65532:65532 /tmp/hanzo-agents-data
|
|
|
|
FROM ghcr.io/hanzoai/debian12:base
|
|
COPY --from=go-builder /app/bin/hanzo-agents-server /usr/local/bin/hanzo-agents-server
|
|
COPY --from=go-builder /app/control-plane/config /etc/hanzo-agents/config
|
|
COPY --from=go-builder --chown=nonroot:nonroot /tmp/hanzo-agents-data /data
|
|
USER nonroot:nonroot
|
|
ENTRYPOINT ["/usr/local/bin/hanzo-agents-server"]
|
|
|
|
# TODO(ghcr-auth): CI workflows building this image must `docker login`
|
|
# to ghcr.io/hanzoai with a PAT (secret: GHCR_PULL_TOKEN) — the default
|
|
# GITHUB_TOKEN scopes to the repo's own package only.
|