From f9f423c078f3b106fe1a87fd60c86eb2d606e2bf Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 17 Jul 2021 14:33:17 +0200 Subject: [PATCH] Dockerfile.test: standard directory to collect build aftifacts This allows for easier copying artifacts from stages, by just copying the directory content to the stage where it's used. These stages are not used to be run individually so do not have to be "runnable". Each stage is "responsible" for colllecting all aftifacts in the directory, so that "consumer" stages do not have to be aware of what needs to be copied. Signed-off-by: Sebastiaan van Stijn --- contrib/Dockerfile.test | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/contrib/Dockerfile.test b/contrib/Dockerfile.test index 3da24cf32..c823daf4f 100644 --- a/contrib/Dockerfile.test +++ b/contrib/Dockerfile.test @@ -24,6 +24,7 @@ COPY script/setup/runc-version script/setup/install-runc ./ # Allow overriding the version of runc to install through build-args ARG RUNC_VERSION ARG GOPROXY=direct +ARG DESTDIR=/build RUN ./install-runc FROM golang AS build-env @@ -46,7 +47,7 @@ FROM build-env AS cri-in-userns RUN apt-get update && apt-get install -y iptables COPY contrib/Dockerfile.test.d/cri-in-userns/etc_containerd_config.toml /etc/containerd/config.toml COPY contrib/Dockerfile.test.d/cri-in-userns/docker-entrypoint.sh /docker-entrypoint.sh -COPY --from=runc /usr/local/sbin/runc /usr/local/go/bin/runc +COPY --from=runc /build/ / COPY . . RUN ./script/setup/install-cni RUN ./script/setup/install-critools @@ -60,19 +61,20 @@ CMD ["critest", "--ginkgo.skip=should support unsafe sysctls|should support safe # Install proto3 FROM golang AS proto3 -RUN apt-get update && apt-get install -y \ - autoconf \ - automake \ - g++ \ - libtool \ - unzip \ - --no-install-recommends +ARG DESTDIR=/build +RUN apt-get update && apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + g++ \ + libtool \ + unzip COPY script/setup/install-protobuf install-protobuf -RUN ./install-protobuf +RUN ./install-protobuf \ + && mv /usr/local/bin/protoc $DESTDIR/usr/local/bin/protoc \ + && mv /usr/local/include/google $DESTDIR/usr/local/include/google FROM build-env AS dev -COPY --from=proto3 /usr/local/bin/protoc /usr/local/bin/protoc -COPY --from=proto3 /usr/local/include/google /usr/local/include/google -COPY --from=runc /usr/local/sbin/runc /usr/local/go/bin/runc +COPY --from=proto3 /build/ / +COPY --from=runc /build/ / COPY . .