@@ -11,7 +11,7 @@ ARG BUILDX_VERSION=0.11.2
1111FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
1212
1313FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build-base-alpine
14- COPY --from=xx / /
14+ COPY --link -- from=xx / /
1515RUN apk add --no-cache bash clang lld llvm file git
1616WORKDIR /go/src/github.com/docker/cli
1717
@@ -21,7 +21,7 @@ ARG TARGETPLATFORM
2121RUN xx-apk add --no-cache musl-dev gcc
2222
2323FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bullseye AS build-base-bullseye
24- COPY --from=xx / /
24+ COPY --link -- from=xx / /
2525RUN apt-get update && apt-get install --no-install-recommends -y bash clang lld llvm file
2626WORKDIR /go/src/github.com/docker/cli
2727
@@ -62,7 +62,7 @@ ARG CGO_ENABLED
6262ARG VERSION
6363# PACKAGER_NAME sets the company that produced the windows binary
6464ARG PACKAGER_NAME
65- COPY --from=goversioninfo /out/goversioninfo /usr/bin/goversioninfo
65+ COPY --link -- from=goversioninfo /out/goversioninfo /usr/bin/goversioninfo
6666# in bullseye arm64 target does not link with lld so configure it to use ld instead
6767RUN [ ! -f /etc/alpine-release ] && xx-info is-cross && [ "$(xx-info arch)" = "arm64" ] && XX_CC_PREFER_LINKER=ld xx-clang --setup-target-triple || true
6868RUN --mount=type=bind,target=.,ro \
@@ -76,7 +76,7 @@ RUN --mount=type=bind,target=.,ro \
7676 xx-verify $([ "$GO_LINKMODE" = "static" ] && echo "--static" ) /out/docker
7777
7878FROM build-${BASE_VARIANT} AS test
79- COPY --from=gotestsum /out/gotestsum /usr/bin/gotestsum
79+ COPY --link -- from=gotestsum /out/gotestsum /usr/bin/gotestsum
8080ENV GO111MODULE=auto
8181RUN --mount=type=bind,target=.,rw \
8282 --mount=type=cache,target=/root/.cache \
@@ -111,19 +111,19 @@ FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
111111FROM e2e-base-${BASE_VARIANT} AS e2e
112112ARG NOTARY_VERSION=v0.6.1
113113ADD --chmod=0755 https://github.com/theupdateframework/notary/releases/download/${NOTARY_VERSION}/notary-Linux-amd64 /usr/local/bin/notary
114- COPY e2e/testdata/notary/root-ca.cert /usr/share/ca-certificates/notary.cert
114+ COPY --link e2e/testdata/notary/root-ca.cert /usr/share/ca-certificates/notary.cert
115115RUN echo 'notary.cert' >> /etc/ca-certificates.conf && update-ca-certificates
116- COPY --from=gotestsum /out/gotestsum /usr/bin/gotestsum
117- COPY --from=build /out ./build/
118- COPY --from=build-plugins /out ./build/
119- COPY --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
120- COPY . .
116+ COPY --link -- from=gotestsum /out/gotestsum /usr/bin/gotestsum
117+ COPY --link -- from=build /out ./build/
118+ COPY --link -- from=build-plugins /out ./build/
119+ COPY --link -- from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
120+ COPY --link . .
121121ENV DOCKER_BUILDKIT=1
122122ENV PATH=/go/src/github.com/docker/cli/build:$PATH
123123CMD ./scripts/test/e2e/entry
124124
125125FROM build-base-${BASE_VARIANT} AS dev
126- COPY . .
126+ COPY --link . .
127127
128128FROM scratch AS plugins
129129COPY --from=build-plugins /out .
0 commit comments