Files
kms/Dockerfile
zeekay a09fcae7b1
Docker Build & Push (Reusable) / create-manifest (push) Blocked by required conditions
Docker Build & Push (Reusable) / tag-single-arch (push) Blocked by required conditions
Docker Build & Push (Reusable) / deploy (push) Blocked by required conditions
Docker Build & Push (Reusable) / sbom (push) Blocked by required conditions
Docker Build & Push (Reusable) / build-amd64 (push) Waiting to run
Docker Build & Push (Reusable) / build-arm64 (push) Skipped
Build kms / build (push) Waiting to run
Docker Release / lint-and-typecheck (backend) (push) Waiting to run
Docker Release / lint-and-typecheck (frontend) (push) Waiting to run
Docker Release / unit-tests (push) Waiting to run
Docker Release / docker (push) Blocked by required conditions
Docker Release / dispatch-to-universe (push) Blocked by required conditions
Docker Build & Push (Reusable) / create-manifest (push) Blocked by required conditions
Docker Build & Push (Reusable) / tag-single-arch (push) Blocked by required conditions
Docker Build & Push (Reusable) / deploy (push) Blocked by required conditions
Docker Build & Push (Reusable) / sbom (push) Blocked by required conditions
Docker Build & Push (Reusable) / build-amd64 (push) Waiting to run
Docker Build & Push (Reusable) / build-arm64 (push) Skipped
Docker (standalone) / docker (Dockerfile, ghcr.io/hanzoai/kms) (push) Waiting to run
build(docker): consume git token via BuildKit secret mount (platform/arcd)
The platform/arcd in-cluster BuildKit Job passes the private-module git
token as --secret=id=GIT_AUTH_TOKEN. Prefer the mounted secret (never
baked into image metadata); fall back to ARG GITHUB_TOKEN for the legacy
build-arg path. One git-config, two callers.
2026-06-23 10:24:05 -07:00

69 lines
2.4 KiB
Docker

# Hanzo KMS — thin wrapper over luxfi/kms.
#
# Build is now pure Go (no SQLCipher, no Base, no TS frontend toolchain
# required). The TS dashboard ships as a static asset built in a separate
# stage and copied verbatim.
FROM node:22-alpine AS frontend
WORKDIR /src/frontend
COPY frontend/package.json frontend/pnpm-lock.yaml ./
RUN corepack enable pnpm && pnpm install --frozen-lockfile
COPY frontend/ .
RUN pnpm vite build
FROM golang:1.26-bookworm AS build
# GITHUB_TOKEN reaches the build for private go-module access (hanzoai/*).
# Two callers, one git-config: the platform/arcd BuildKit Job mounts it as a
# secret (`--secret=id=GIT_AUTH_TOKEN`, never in image metadata); the legacy
# build-arg path (.github/workflows/build.yml) passes ARG GITHUB_TOKEN. The
# RUN below prefers the mounted secret and falls back to the ARG.
ARG GITHUB_TOKEN
ARG TARGETARCH
WORKDIR /src
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=secret,id=GIT_AUTH_TOKEN \
TOKEN="$(cat /run/secrets/GIT_AUTH_TOKEN 2>/dev/null || echo "${GITHUB_TOKEN}")" && \
GOPRIVATE="github.com/luxfi/*,github.com/hanzoai/*" \
GONOSUMCHECK="github.com/luxfi/*,github.com/hanzoai/*" \
git config --global url."https://${TOKEN}@github.com/".insteadOf "https://github.com/" && \
go mod download
COPY . .
# Pure Go build — no CGO required (luxfi/kms uses ZapDB, not SQLCipher).
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
go build -ldflags="-s -w" -o /kmsd ./cmd/kmsd/ && \
go build -ldflags="-s -w" -o /kms ./cmd/kms/
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
COPY --from=build /kmsd /usr/local/bin/kmsd
COPY --from=build /kms /usr/local/bin/kms
COPY --from=frontend /src/frontend/dist /app/frontend
# Hanzo defaults — the binary already defaults to these, env vars only
# document them for operators inspecting the image.
ENV KMS_LISTEN=:8443 \
KMS_ZAP_PORT=9653 \
KMS_DATA_DIR=/data/hanzo-kms \
KMS_NODE_ID=hanzo-kms-0 \
KMS_FRONTEND_DIR=/app/frontend \
BRAND_NAME=Hanzo
RUN mkdir -p /data/hanzo-kms
EXPOSE 8443 9653
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8443/healthz || exit 1
ENTRYPOINT ["kmsd"]