Split Dockerfile: pre-built golangci-lint stage for faster CI #45
Reference in New Issue
Block a user
Delete Branch "split-dockerfile-lint-stage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #39
Splits the Dockerfile into a dedicated lint stage using the
golangci/golangci-lintimage directly, rather than copying the binary into the builder stage.Changes
Dockerfile
AS lint): Uses the pre-builtgolangci/golangci-lintimage (pinned by sha256) to runmake fmt-checkandmake lint. This is a self-contained stage with its owngo mod downloadand source copy.AS builder): Runs onlymake testand the final binary build. No longer needs golangci-lint installed.COPY --from=lint /src/go.sum /dev/nullforces BuildKit to always execute the lint stage (without this, unused stages are silently skipped).mfer/mf.pb.goto prevent make from trying to regenerate via protoc.With BuildKit, the lint and builder stages run in parallel after their shared
go mod downloadlayers complete, so lint/formatting failures surface much faster without blocking on test execution.Makefile
lintto thechecktarget prereqs:check: test lint fmt-check(wascheck: test fmt-check), matching the REPO_POLICIES requirement.