mfer/Dockerfile
clawbot acbdf3a376
Some checks failed
check / check (pull_request) Failing after 6s
Add make check target and CI workflow (#36)
Adds a `make check` target that verifies formatting (gofmt), linting (golangci-lint), and tests (go test -race) without modifying files.

Also adds `.gitea/workflows/check.yml` CI workflow that runs on pushes and PRs to main and next.

`make check` passes cleanly on current next branch.

Co-authored-by: clawbot <clawbot@noreply.git.eeqj.de>
Reviewed-on: #36
Co-authored-by: clawbot <clawbot@noreply.example.org>
Co-committed-by: clawbot <clawbot@noreply.example.org>
2026-03-02 11:04:46 +01:00

47 lines
1.4 KiB
Docker

################################################################################
# Lint stage — fast feedback on formatting and lint issues
################################################################################
# golangci/golangci-lint:v1.64.8
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
################################################################################
# Build stage — tests and compilation
################################################################################
# golang:1.24-alpine
FROM golang@sha256:8bee1901f1e530bfb4a7850aa7a479d17ae3a18beb6e09064ed54cfd245b7191 AS builder
# Force BuildKit to run the lint stage by creating a stage dependency
COPY --from=lint /src/go.sum /dev/null
RUN apk add --no-cache git make zstd
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN make test
RUN make build
# Archive source for posterity
RUN go mod vendor && tar -c . | zstd -T0 -19 -o /src.tzst
################################################################################
# Final image
################################################################################
FROM scratch
# we put all the source into the final image for posterity, it's small
COPY --from=builder /src.tzst /src.tzst
COPY --from=builder /build/bin/mfer /mfer
ENTRYPOINT ["/mfer"]