Debian Codegraph @

engine/vendor/github.com/tonistiigi/go-csvvalue/Dockerfile

raw
1 #syntax=docker/dockerfile:1.8
2 #check=error=true
3
4 ARG GO_VERSION=1.23
5 ARG XX_VERSION=1.4.0
6
7 ARG COVER_FILENAME="cover.out"
8 ARG BENCH_FILENAME="bench.txt"
9
10 FROM --platform=${BUILDPLATFORM} tonistiigi/xx:${XX_VERSION} AS xx
11
12 FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine AS golang
13 COPY --link --from=xx / /
14 WORKDIR /src
15 ARG TARGETPLATFORM
16
17 FROM golang AS build
18 RUN --mount=target=/root/.cache,type=cache \
19 --mount=type=bind xx-go build .
20
21 FROM golang AS runbench
22 ARG BENCH_FILENAME
23 RUN --mount=target=/root/.cache,type=cache \
24 --mount=type=bind \
25 xx-go test -v --run skip --bench . | tee /tmp/${BENCH_FILENAME}
26
27 FROM scratch AS bench
28 ARG BENCH_FILENAME
29 COPY --from=runbench /tmp/${BENCH_FILENAME} /
30
31 FROM golang AS runtest
32 ARG TESTFLAGS="-v"
33 ARG COVER_FILENAME
34 RUN --mount=target=/root/.cache,type=cache \
35 --mount=type=bind \
36 xx-go test -coverprofile=/tmp/${COVER_FILENAME} $TESTFLAGS .
37
38 FROM scratch AS test
39 ARG COVER_FILENAME
40 COPY --from=runtest /tmp/${COVER_FILENAME} /
41
42 FROM build