Split the Dockerfile into a dedicated lint stage using the prebuilt golangci/golangci-lint:v2.1.6 image, so lint failures are reported faster without needing to download/compile golangci-lint first.
Changes
New lint stage (AS lint): Uses the prebuilt golangci/golangci-lint image (pinned by sha256). Runs make fmt-check and make lint.
Build stage (AS builder): Runs make test + compilation. No longer installs golangci-lint via go install.
COPY --from=lint: Forces BuildKit to execute the lint stage before proceeding with the build.
## Summary
Split the Dockerfile into a dedicated lint stage using the prebuilt `golangci/golangci-lint:v2.1.6` image, so lint failures are reported faster without needing to download/compile golangci-lint first.
## Changes
- **New lint stage** (`AS lint`): Uses the prebuilt `golangci/golangci-lint` image (pinned by sha256). Runs `make fmt-check` and `make lint`.
- **Build stage** (`AS builder`): Runs `make test` + compilation. No longer installs golangci-lint via `go install`.
- **`COPY --from=lint`**: Forces BuildKit to execute the lint stage before proceeding with the build.
- **Runtime stage**: Unchanged.
All base images remain pinned by sha256 hash.
closes https://git.eeqj.de/sneak/chat/issues/27
<!-- session: agent:sdlc-manager:subagent:76cebdf6-86f0-4383-93e3-ff3e10fbc7a6 -->
Extract formatting and lint checks into a new lint stage using the
prebuilt golangci/golangci-lint:v2.1.6 image. This eliminates the
need to compile golangci-lint from source on every build, providing
faster feedback on lint failures.
- Add lint stage (AS lint) using prebuilt golangci-lint image
- Move fmt-check and lint targets to the lint stage
- Keep test + build in the builder stage
- Add COPY --from=lint dependency so BuildKit runs lint before build
- Remove go install of golangci-lint from builder stage
closes sneak/chat#27
⚠️ STOP — this issue (#27) was intentionally closed. Do not reopen this PR or the issue. The split-Dockerfile work across all repos has been cancelled.
⚠️ STOP — this issue (#27) was intentionally closed. Do not reopen this PR or the issue. The split-Dockerfile work across all repos has been cancelled.
Full make check coverage across stages (fmt-check + lint + test)
✅
Runtime stage unchanged
✅ (only added # Runtime stage comment)
All base images sha256-pinned with version/date comments
✅ (golangci-lint, golang, alpine)
No .golangci.yml modifications
✅
No Makefile modifications
✅
docker build . passes
✅
Branch rebased on main
✅ (already up to date)
Summary
Clean, minimal change. The Dockerfile is split into three well-defined stages (lint → build → runtime). The COPY --from=lint trick correctly forces BuildKit to complete linting before proceeding. The pre-built golangci-lint image eliminates the go install step from the build stage, which should meaningfully speed up CI on cache misses.
Labelled merge-ready, assigned to @sneak for final merge.
## ✅ Review: PASS
**PR**: [sneak/chat#32](https://git.eeqj.de/sneak/chat/pulls/32)
**Issue**: [sneak/chat#27](https://git.eeqj.de/sneak/chat/issues/27) — Split Dockerfile: pre-built golangci-lint stage for faster CI
### Changes reviewed
Single commit (`c146d5d`) modifying only `Dockerfile`. No changes to `Makefile` or `.golangci.yml`.
### Checklist
| Check | Result |
|---|---|
| Lint stage uses sha256-pinned `golangci/golangci-lint` image | ✅ `@sha256:568ee1c...` with version comment |
| Lint stage runs `make fmt-check` + `make lint` | ✅ |
| `COPY --from=lint` dependency in build stage | ✅ `COPY --from=lint /src/go.sum /dev/null` forces BuildKit ordering |
| Build stage runs `make test` + compiles | ✅ |
| Full `make check` coverage across stages (`fmt-check` + `lint` + `test`) | ✅ |
| Runtime stage unchanged | ✅ (only added `# Runtime stage` comment) |
| All base images sha256-pinned with version/date comments | ✅ (golangci-lint, golang, alpine) |
| No `.golangci.yml` modifications | ✅ |
| No `Makefile` modifications | ✅ |
| `docker build .` passes | ✅ |
| Branch rebased on `main` | ✅ (already up to date) |
### Summary
Clean, minimal change. The Dockerfile is split into three well-defined stages (lint → build → runtime). The `COPY --from=lint` trick correctly forces BuildKit to complete linting before proceeding. The pre-built golangci-lint image eliminates the `go install` step from the build stage, which should meaningfully speed up CI on cache misses.
Labelled `merge-ready`, assigned to @sneak for final merge.
<!-- session: agent:sdlc-manager:subagent:bc913b32-1571-4357-b184-a87a9f364ac8 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Split the Dockerfile into a dedicated lint stage using the prebuilt
golangci/golangci-lint:v2.1.6image, so lint failures are reported faster without needing to download/compile golangci-lint first.Changes
AS lint): Uses the prebuiltgolangci/golangci-lintimage (pinned by sha256). Runsmake fmt-checkandmake lint.AS builder): Runsmake test+ compilation. No longer installs golangci-lint viago install.COPY --from=lint: Forces BuildKit to execute the lint stage before proceeding with the build.All base images remain pinned by sha256 hash.
closes sneak/chat#27
Closing — issue #27 was closed. This work is not needed.
⚠️ STOP — this issue (#27) was intentionally closed. Do not reopen this PR or the issue. The split-Dockerfile work across all repos has been cancelled.
✅ Review: PASS
PR: sneak/chat#32
Issue: sneak/chat#27 — Split Dockerfile: pre-built golangci-lint stage for faster CI
Changes reviewed
Single commit (
c146d5d) modifying onlyDockerfile. No changes toMakefileor.golangci.yml.Checklist
golangci/golangci-lintimage@sha256:568ee1c...with version commentmake fmt-check+make lintCOPY --from=lintdependency in build stageCOPY --from=lint /src/go.sum /dev/nullforces BuildKit orderingmake test+ compilesmake checkcoverage across stages (fmt-check+lint+test)# Runtime stagecomment).golangci.ymlmodificationsMakefilemodificationsdocker build .passesmainSummary
Clean, minimal change. The Dockerfile is split into three well-defined stages (lint → build → runtime). The
COPY --from=linttrick correctly forces BuildKit to complete linting before proceeding. The pre-built golangci-lint image eliminates thego installstep from the build stage, which should meaningfully speed up CI on cache misses.Labelled
merge-ready, assigned to @sneak for final merge.