mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
The official golang images set GOTOOLCHAIN=local, so a base older than the
governing go.mod `go` directive fails hard instead of fetching a toolchain:
go: go.mod requires go >= 1.26.5 (running go 1.26.4; GOTOOLCHAIN=local)
docker/Dockerfile.multi-node sat on golang:1.24.5-alpine, two minor versions
under the root go.mod floor of 1.26.4. Dockerfile, deploy/testnet/Dockerfile
and Dockerfile.dvenue were at 1.26.4 — exactly at the floor, with no headroom.
Two orthogonal halves:
1. pin every Go builder base to the latest stable patch, 1.26.5, so the
images carry current compiler and stdlib security fixes;
2. set GOTOOLCHAIN=auto in every Go builder stage, so a future floor bump
downloads a checksum-verified toolchain rather than hard-failing.
Dockerfile and deploy/testnet already had it; multi-node and dvenue
did not.
Half 2 is not hypothetical here: sdk/lx-trading-go/go.mod already declares
go 1.26.5, above the root module's 1.26.4, so a submodule build under
GOTOOLCHAIN=local would die at exactly this error.
The root `go` directive stays at 1.26.4 on purpose — raising it pushes a hard
patch-level floor onto every consumer. A newer toolchain building an older
directive is always valid.
docs/Dockerfile is untouched: it builds static docs and compiles no Go.
Co-authored-by: Hanzo Dev <[email protected]>
59 lines
1.3 KiB
Docker
59 lines
1.3 KiB
Docker
# Multi-stage build for LX multi-node
|
|
FROM golang:1.26.5-alpine AS builder
|
|
|
|
# The golang images set GOTOOLCHAIN=local, which turns a go.mod `go` directive
|
|
# newer than this base into a hard build failure. `auto` lets go fetch the
|
|
# required toolchain (checksum-verified via sum.golang.org) instead.
|
|
ENV GOTOOLCHAIN=auto
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache \
|
|
gcc \
|
|
g++ \
|
|
make \
|
|
git \
|
|
zeromq-dev \
|
|
pkgconfig
|
|
|
|
# Set working directory
|
|
WORKDIR /build
|
|
|
|
# Copy go mod files
|
|
COPY backend/go.mod backend/go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY backend/ ./
|
|
|
|
# Build multi-node binary
|
|
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o multi-node ./cmd/multi-node/main.go
|
|
|
|
# Build test client
|
|
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o test-client ./cmd/multi-node/client.go
|
|
|
|
# Final stage
|
|
FROM alpine:latest
|
|
|
|
# Install runtime dependencies
|
|
RUN apk add --no-cache \
|
|
zeromq \
|
|
ca-certificates
|
|
|
|
# Create app directory
|
|
WORKDIR /app
|
|
|
|
# Copy binaries from builder
|
|
COPY --from=builder /build/multi-node /app/
|
|
COPY --from=builder /build/test-client /app/
|
|
|
|
# Create logs directory
|
|
RUN mkdir -p /app/logs
|
|
|
|
# Expose ports
|
|
# PUB, SUB, ROUTER, DEALER
|
|
EXPOSE 5000 5001 5002 5003
|
|
EXPOSE 5100 5101 5102 5103
|
|
EXPOSE 5200 5201 5202 5203
|
|
|
|
# Default command
|
|
CMD ["/app/multi-node"] |