mirror of
https://github.com/hanzoai/s3-csi.git
synced 2026-09-30 23:52:32 +00:00
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]>
31 lines
800 B
Docker
31 lines
800 B
Docker
# S3_COMMIT should match the commit in go.mod for reproducibility
|
|
# Update via: docker build --build-arg S3_COMMIT=<hash> ...
|
|
ARG S3_COMMIT=19ce7c0b6fdb
|
|
|
|
FROM golang:1.26.5-alpine AS builder
|
|
ENV GOTOOLCHAIN=auto
|
|
|
|
RUN apk add git g++
|
|
|
|
# Build s3 binary from a specific commit for reproducibility
|
|
ARG S3_COMMIT
|
|
RUN git clone https://github.com/s3/s3 /go/src/github.com/s3/s3 \
|
|
&& cd /go/src/github.com/s3/s3 \
|
|
&& git checkout ${S3_COMMIT} \
|
|
&& cd s3 \
|
|
&& go install
|
|
|
|
# Build s3-mount from current context
|
|
WORKDIR /go/src/github.com/s3/s3-csi-driver
|
|
COPY . .
|
|
|
|
RUN go build -ldflags="-s -w" -o /s3-mount ./cmd/s3-mount/main.go
|
|
|
|
FROM alpine AS final
|
|
RUN apk add fuse
|
|
COPY --from=builder /go/bin/s3 /usr/bin/
|
|
COPY --from=builder /s3-mount /
|
|
|
|
RUN chmod +x /s3-mount
|
|
ENTRYPOINT ["/s3-mount"]
|