FROM golang:1.24-alpine AS builder ARG TELEBIT_REF=master ARG TARGETOS=linux ARG TARGETARCH=amd64 RUN apk add --no-cache git WORKDIR /src RUN git clone --depth 1 --branch "${TELEBIT_REF}" https://github.com/therootcompany/telebit.git . RUN go generate -mod=vendor ./... # The upstream vendored x/net revision does not build on current macOS toolchains. RUN go get golang.org/x/net@v0.40.0 RUN CGO_ENABLED=0 GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" go build -mod=mod -o /out/telebit ./cmd/telebit RUN CGO_ENABLED=0 GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" go build -mod=mod -o /out/signjwt ./cmd/signjwt FROM scratch AS export COPY --from=builder /out/ /