# Lint stage. The format check is not here: it runs on the host, in # script/fmt-check. # golangci/golangci-lint:v2.14.0 (Debian-based), 2026-09-24 FROM golangci/golangci-lint@sha256:ad862ba6b3798cbe0fd9fd7408d498fd74fbd2623a92406b2fd3898faf0bf98f AS lint WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . # Called directly: make lint is itself a docker build of this stage. RUN golangci-lint run --config .golangci.yml ./... # Test stage: run full test suite under the race detector # golang 1.22.12 (Debian-based; -race needs its C toolchain), 2025-02-04 FROM golang@sha256:1cf6c45ba39db9fd6db16922041d074a63c935556a05c5ccb62d181034df7f02 AS test WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . # Called directly: make test is itself a docker build of this stage. RUN go test -timeout 90s -race -cover ./... || \ { echo "--- Rerunning with -v for details ---"; \ go test -timeout 90s -race -v ./...; exit 1; } # Final stage: a development environment, set up by script/bootstrap. # The copies make a plain docker build run both stages above. No stage # compiles a binary, since simplelog is a library, so none declares the # VERSION build argument that script/docker and script/cibuild pass. # golang 1.22.12 (2025-02-04) FROM golang@sha256:1cf6c45ba39db9fd6db16922041d074a63c935556a05c5ccb62d181034df7f02 COPY --from=lint /src/go.sum /dev/null COPY --from=test /src/go.sum /dev/null WORKDIR /src COPY script/ script/ COPY go.mod go.sum package.json yarn.lock ./ RUN script/bootstrap COPY . .