Debian Codegraph @

engine/vendor/github.com/tonistiigi/go-actions-cache/Dockerfile

raw
1 # syntax=docker/dockerfile:1
2
3 ARG GO_VERSION=1.24
4 ARG XX_VERSION=1.6.1
5
6 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
7
8 FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
9 RUN apk add --no-cache git openssl
10 COPY --from=xx / /
11 WORKDIR /src
12
13 FROM base AS test
14 ARG TESTFLAGS
15 ARG GITHUB_REPOSITORY
16 ARG ACTIONS_CACHE_URL
17 ARG ACTIONS_CACHE_API_FORCE_VERSION
18 ARG ACTIONS_CACHE_SERVICE_V2
19 ARG ACTIONS_RESULTS_URL
20 RUN --mount=target=. \
21 --mount=target=/go/pkg/mod,type=cache \
22 --mount=target=/root/.cache,type=cache \
23 --mount=type=secret,id=GITHUB_TOKEN,env=GITHUB_TOKEN \
24 --mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
25 CGO_ENABLED=0 xx-go test -v -coverprofile=/tmp/coverage.txt -covermode=atomic ${TESTFLAGS} ./...
26
27 FROM scratch AS test-coverage
28 COPY --from=test /tmp/coverage.txt /