github.com/xeptore/docker-cli@v20.10.14+incompatible/Dockerfile (about) 1 # syntax=docker/dockerfile:1.3 2 3 ARG BASE_VARIANT=alpine 4 ARG GO_VERSION=1.16.15 5 ARG XX_VERSION=1.0.0-rc.2 6 7 FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${BASE_VARIANT} AS gostable 8 FROM --platform=$BUILDPLATFORM golang:1.17rc1-${BASE_VARIANT} AS golatest 9 10 FROM gostable AS go-linux 11 FROM gostable AS go-darwin 12 FROM gostable AS go-windows-amd64 13 FROM gostable AS go-windows-386 14 FROM gostable AS go-windows-arm 15 FROM golatest AS go-windows-arm64 16 FROM go-windows-${TARGETARCH} AS go-windows 17 18 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx 19 20 FROM go-${TARGETOS} AS build-base-alpine 21 COPY --from=xx / / 22 RUN apk add --no-cache clang lld llvm file git 23 WORKDIR /go/src/github.com/docker/cli 24 25 FROM build-base-alpine AS build-alpine 26 ARG TARGETPLATFORM 27 # gcc is installed for libgcc only 28 RUN xx-apk add --no-cache musl-dev gcc 29 30 FROM go-${TARGETOS} AS build-base-buster 31 COPY --from=xx / / 32 RUN apt-get update && apt-get install --no-install-recommends -y clang lld file 33 WORKDIR /go/src/github.com/docker/cli 34 35 FROM build-base-buster AS build-buster 36 ARG TARGETPLATFORM 37 RUN xx-apt install --no-install-recommends -y libc6-dev libgcc-8-dev 38 39 FROM build-${BASE_VARIANT} AS build 40 # GO_LINKMODE defines if static or dynamic binary should be produced 41 ARG GO_LINKMODE=static 42 # GO_BUILDTAGS defines additional build tags 43 ARG GO_BUILDTAGS 44 # GO_STRIP strips debugging symbols if set 45 ARG GO_STRIP 46 # CGO_ENABLED manually sets if cgo is used 47 ARG CGO_ENABLED 48 # VERSION sets the version for the produced binary 49 ARG VERSION 50 RUN --mount=ro --mount=type=cache,target=/root/.cache \ 51 --mount=from=dockercore/golang-cross:xx-sdk-extras,target=/xx-sdk,src=/xx-sdk \ 52 --mount=type=tmpfs,target=cli/winresources \ 53 xx-go --wrap && \ 54 # export GOCACHE=$(go env GOCACHE)/$(xx-info)$([ -f /etc/alpine-release ] && echo "alpine") && \ 55 TARGET=/out ./scripts/build/binary && \ 56 xx-verify $([ "$GO_LINKMODE" = "static" ] && echo "--static") /out/docker 57 58 FROM build-base-${BASE_VARIANT} AS dev 59 COPY . . 60 61 FROM scratch AS binary 62 COPY --from=build /out .