Files
zeekayandHanzo Dev 2c05079a08 docker: pin the Go builders to 1.26.5 and let the toolchain upgrade itself
The official golang images set GOTOOLCHAIN=local, so a builder stage older
than the governing go.mod directive does not upgrade — it dies:

    go: go.mod requires go >= 1.26.5 (running go 1.26.4; GOTOOLCHAIN=local)

go.mod here is go 1.26.5, and the two dev builders were on golang:1.24-alpine
and golang:1.25-alpine.

Two independent halves:
  1. pin the dev builders to golang:1.26.5-alpine;
  2. set ENV GOTOOLCHAIN=auto in every Go builder stage — including the two
     images hanzo.yml actually publishes (s3-csi, s3-mount). Those sit on the
     floating golang:1.26-alpine tag, which satisfies the directive today and
     silently stops satisfying it the day go.mod crosses 1.27. GOTOOLCHAIN=auto
     makes that a checksum-verified download (sum.golang.org) rather than a
     failed release build. Their pins are left alone; only the ENV is added.

Separately, and NOT fixed here because it is a different bug: both .dev
builders `git clone https://github.com/s3/s3`, which is HTTP 404 — a stale
pre-rebrand URL. `make container-csi` / `container-mount` therefore cannot
succeed regardless of the Go pin. They are stale duplicates of
cmd/s3-csi-driver/Dockerfile and cmd/s3-mount/Dockerfile, which build the
same binaries correctly against github.com/hanzoai/s3 and are the ones
hanzo.yml and the integration workflow use. Deleting them and dropping the
Makefile targets is the DRY fix, but that is a deliberate call, not a
side effect of a toolchain patch.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-01 16:18:12 -07:00

40 lines
1.4 KiB
Docker

# S3_REF pins the hanzoai/s3 source this image builds its `s3` binary from, and
# it MUST track the github.com/hanzoai/s3 version in go.mod — the mount daemon
# and the driver have to speak the same filer wire protocol as the server.
#
# The DEFAULT is load-bearing: our builder invokes buildkit with no --build-arg,
# so whatever is written here is what actually ships. It was left at a bare
# commit from before v1.0.2/v1.0.3/v1.0.4, which would have shipped a mount
# binary carrying the promise-ID deadlock and the stream head-of-line stall
# those releases fixed. Pin the TAG so it is legible and diffable against go.mod.
ARG S3_REF=v1.0.14
FROM golang:1.26-alpine AS builder
ENV GOTOOLCHAIN=auto
RUN apk add git g++
# Build the s3 binary from a specific commit for reproducibility
ARG S3_REF
RUN git clone https://github.com/hanzoai/s3 /go/src/github.com/hanzoai/s3 \
&& cd /go/src/github.com/hanzoai/s3 \
&& git checkout ${S3_REF} \
&& cd s3 \
&& go install \
&& go clean -cache -modcache
# Build s3-mount from current context
WORKDIR /go/src/github.com/hanzoai/s3-csi
COPY . .
RUN go build -ldflags="-s -w" -o /s3-mount ./cmd/s3-mount/main.go && go clean -cache -modcache
FROM alpine AS final
RUN apk add fuse
LABEL org.opencontainers.image.source="https://github.com/hanzoai/s3-csi"
COPY --from=builder /go/bin/s3 /usr/bin/
COPY --from=builder /s3-mount /
RUN chmod +x /s3-mount
ENTRYPOINT ["/s3-mount"]