mirror of
https://github.com/crazy-max/diun.git
synced 2024-12-22 19:38:28 +00:00
17 lines
454 B
Docker
17 lines
454 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
ARG GO_VERSION=1.19
|
|
|
|
FROM golang:${GO_VERSION}-alpine AS base
|
|
RUN apk add --no-cache gcc git linux-headers musl-dev
|
|
WORKDIR /src
|
|
|
|
FROM base AS test
|
|
RUN --mount=type=bind,target=. \
|
|
--mount=type=cache,target=/root/.cache \
|
|
go test -v -coverprofile=/tmp/coverage.txt -covermode=atomic -race ./... && \
|
|
go tool cover -func=/tmp/coverage.txt
|
|
|
|
FROM scratch AS test-coverage
|
|
COPY --from=test /tmp/coverage.txt /coverage.txt
|