Files
ltx/Dockerfile
zeekayandHanzo Dev ea96fea984 build: pin the Go builder to 1.26.5 and let the toolchain download
The official golang images set GOTOOLCHAIN=local, so a go.mod `go` directive
newer than the base image fails the build at the first go command:

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

Two orthogonal changes. Pinning the base to the exact patch go.mod names makes
the build hermetic — the versions match, so no toolchain is downloaded.
GOTOOLCHAIN=auto is the resilience half: when go.mod next moves ahead of the
pin, the toolchain is fetched and checksum-verified against sum.golang.org
instead of failing the build outright.

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

20 lines
553 B
Docker

FROM golang:1.26.5 AS builder
# go.mod pins the toolchain. The golang base image sets GOTOOLCHAIN=local,
# which turns a `go` directive newer than the image into a hard build
# failure instead of a download.
ENV GOTOOLCHAIN=auto
WORKDIR /src/ltx
COPY . .
ARG LTX_VERSION=
ARG LTX_COMMIT=
RUN go build -ldflags "-s -w -X 'main.Version=${LTX_VERSION}' -X 'main.Commit=${LTX_COMMIT}' -extldflags '-static'" -o /usr/local/bin/ltx ./cmd/ltx
FROM scratch
COPY --from=builder /usr/local/bin/ltx /usr/local/bin/ltx
ENTRYPOINT ["/usr/local/bin/ltx"]
CMD []