mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-25 22:57:59 +08:00

diffs: - https://github.com/docker/cli/compare/v26.1.4..v27.0.1 - https://github.com/docker/docker/compare/v26.1.4..v27.0.1 - https://github.com/moby/buildkit/compare/v0.14.1...aaaf86e5470bffbb395f5c15ad4a1c152642ea30 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
43 lines
1017 B
Docker
43 lines
1017 B
Docker
#syntax=docker/dockerfile:1.8
|
|
#check=error=true
|
|
|
|
ARG GO_VERSION=1.22
|
|
ARG XX_VERSION=1.4.0
|
|
|
|
ARG COVER_FILENAME="cover.out"
|
|
ARG BENCH_FILENAME="bench.txt"
|
|
|
|
FROM --platform=${BUILDPLATFORM} tonistiigi/xx:${XX_VERSION} AS xx
|
|
|
|
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine AS golang
|
|
COPY --link --from=xx / /
|
|
WORKDIR /src
|
|
ARG TARGETPLATFORM
|
|
|
|
FROM golang AS build
|
|
RUN --mount=target=/root/.cache,type=cache \
|
|
--mount=type=bind xx-go build .
|
|
|
|
FROM golang AS runbench
|
|
ARG BENCH_FILENAME
|
|
RUN --mount=target=/root/.cache,type=cache \
|
|
--mount=type=bind \
|
|
xx-go test -v --run skip --bench . | tee /tmp/${BENCH_FILENAME}
|
|
|
|
FROM scratch AS bench
|
|
ARG BENCH_FILENAME
|
|
COPY --from=runbench /tmp/${BENCH_FILENAME} /
|
|
|
|
FROM golang AS runtest
|
|
ARG TESTFLAGS="-v"
|
|
ARG COVER_FILENAME
|
|
RUN --mount=target=/root/.cache,type=cache \
|
|
--mount=type=bind \
|
|
xx-go test -coverprofile=/tmp/${COVER_FILENAME} $TESTFLAGS .
|
|
|
|
FROM scratch AS test
|
|
ARG COVER_FILENAME
|
|
COPY --from=runtest /tmp/${COVER_FILENAME} /
|
|
|
|
FROM build
|