- Pin golangci-lint to v1.64.8 by sha256 digest - Pin golang to 1.22.12 by sha256 digest - Lint stage runs make fmt-check + make lint - Test stage runs make test with dependency on lint stage - Remove redundant final stage (library has no binary) - Add fmt-check, check, hooks targets to Makefile - Add .gitea/workflows/check.yml for CI closes #9
21 lines
608 B
Docker
21 lines
608 B
Docker
# Lint stage: format check + golangci-lint
|
|
# golangci-lint v1.64.8 (2025-02-18)
|
|
FROM golangci/golangci-lint@sha256:2987913e27f4eca9c8a39129d2c7bc1e74fbcf77f181e01cea607be437aa5cb8 AS lint
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN make fmt-check
|
|
RUN make lint
|
|
|
|
# Test stage: run full test suite
|
|
# golang 1.22.12 (2025-02-04)
|
|
FROM golang@sha256:1cf6c45ba39db9fd6db16922041d074a63c935556a05c5ccb62d181034df7f02 AS test
|
|
# Depend on lint stage so both stages always run
|
|
COPY --from=lint /src/go.sum /dev/null
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN make test
|