FROM scratch AS base ENV VERSION=0.15.0 ENV SRC_FILE=v${VERSION}.tar.gz ENV SRC_SITE=https://github.com/moby/buildkit/archive/${SRC_FILE} ENV SRC_HASH=ebf4b82f7379818d8fcfe5c54034e7f93c062c95f663bfd3c2a622583f62a8a4 FROM base AS fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . FROM fetch AS build COPY --from=stagex/musl . / COPY --from=stagex/bash . / COPY --from=stagex/busybox . / COPY --from=stagex/go . / COPY --from=stagex/make . / COPY --from=stagex/gcc . / COPY --from=stagex/binutils . / COPY --from=stagex/pkgconf . / RUN tar -xf ${SRC_FILE} ENV GOPROXY=https://proxy.golang.org,direct ENV GOSUMDB=sum.golang.org ENV GOPATH=/cache/go ENV GOBIN=${GOPATH}/bin ENV PATH=${GOBIN}:${PATH} WORKDIR /buildkit-${VERSION} RUN <<-EOF set -eux mkdir -p out go build -v \ --ldflags=" \ -w -s -buildid= \ -X github.com/moby/buildkit/version.Version=${VERSION} \ -X github.com/moby/buildkit/version.Revision=stagex \ " \ -o out/ \ ./cmd/... rm -r docs/reference EOF FROM build AS install RUN <<-EOF set -eux mkdir -p /rootfs install -Dm755 ./out/* -t /rootfs/usr/bin/ EOF FROM stagex/filesystem AS package COPY --from=install /rootfs/. /