mirror of
https://github.com/hanzoai/team-go.git
synced 2026-10-30 20:22:42 +00:00
The Go transactor and account service for Hanzo Team. History starts here. The previous 107 commits carried the fork's origin in their messages and their tree, and none of it described this code: the Go under pkg/transactor is Hanzo's own work implementing a wire protocol, not a port of anyone's implementation. pkg/transactor/model.json remains, and remains attributed. It is a compiled platform model this transactor loads through go:embed, governed by EPL-2.0 and named in NOTICE. Removing it is a replacement project -- a new compiler and a move off the protocol -- not a deletion.
51 lines
1.7 KiB
Docker
51 lines
1.7 KiB
Docker
# syntax=docker/dockerfile:1
|
||
# Stage 1 — toolchain build (transpile .ts + go build).
|
||
FROM golang:1.26.5-alpine AS build
|
||
|
||
RUN apk add --no-cache git make bash nodejs npm ca-certificates tzdata
|
||
RUN npm install -g esbuild
|
||
|
||
# Create nonroot user/group records to copy into scratch runtime.
|
||
RUN addgroup -g 65532 -S nonroot && adduser -u 65532 -S nonroot -G nonroot
|
||
|
||
# Every module this repo requires is public: the module proxy serves it and the
|
||
# checksum database records it, measured across the whole graph. `go mod
|
||
# download` is therefore a proxy fetch verified against go.sum, needing no
|
||
# credential and no GOPRIVATE, and go.sum stays authoritative for every
|
||
# dependency.
|
||
WORKDIR /src
|
||
COPY go.mod go.sum ./
|
||
RUN go mod download
|
||
|
||
COPY . .
|
||
|
||
# Build .fn.ts → .fn.js, then static go binary.
|
||
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
|
||
RUN make functions && go build -ldflags="-s -w" -o /team ./cmd/team
|
||
|
||
# Stage 2 — scratch runtime. Ships ONLY:
|
||
# - /team (~25–30 MB static binary)
|
||
# - /functions/dist (compiled JS hooks)
|
||
# - /migrations (JS migrations, run by `team migrate up`)
|
||
# - CA certs, tzdata, passwd/group for nonroot user
|
||
FROM scratch
|
||
|
||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
|
||
COPY --from=build /etc/passwd /etc/passwd
|
||
COPY --from=build /etc/group /etc/group
|
||
|
||
WORKDIR /app
|
||
COPY --from=build /team /app/team
|
||
COPY --from=build /src/functions/dist /app/functions/dist
|
||
COPY --from=build /src/migrations /app/migrations
|
||
|
||
ENV TEAM_HOOKS_DIR=/app/functions/dist \
|
||
TEAM_MIGRATIONS_DIR=/app/migrations \
|
||
TEAM_HOOKS_WATCH=false
|
||
|
||
EXPOSE 8080
|
||
USER 65532:65532
|
||
ENTRYPOINT ["/app/team"]
|
||
CMD ["serve", "--http", "0.0.0.0:8080"]
|