0
0
Fork 0
mirror of https://github.com/crazy-max/diun.git synced 2025-01-27 09:09:05 +00:00
crazy-max_diun/hack/test.Dockerfile
CrazyMax fc13b8c22c
Allow to choose status to be notified (#475)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-08-30 14:15:59 +02:00

21 lines
629 B
Docker

# syntax=docker/dockerfile:1.2
ARG GO_VERSION
FROM golang:${GO_VERSION}-alpine AS base
RUN apk add --no-cache gcc linux-headers musl-dev
WORKDIR /src
FROM base AS gomod
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/go/pkg/mod \
go mod tidy && go mod download
FROM gomod AS test
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
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