Dockerfile.test: build critools in a separate stage

Building critools only requires the install script and the critools-version
file (to determin the version to build). Moving it to a separate stage
prevents rebuilding it if unrelated changes are made in the code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-07-17 14:39:36 +02:00
parent 7ec8e2d369
commit 9f7e6335c4
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -43,6 +43,11 @@ COPY script/setup/install-cni ./
COPY go.mod /go/src/github.com/containerd/containerd/go.mod COPY go.mod /go/src/github.com/containerd/containerd/go.mod
RUN ./install-cni RUN ./install-cni
FROM golang AS critools
ARG DESTDIR=/build
COPY script/setup/install-critools script/setup/critools-version ./
RUN GOBIN=$DESTDIR/usr/local/bin ./install-critools
# cri-in-userns stage is for testing "CRI-in-UserNS", which should be used in conjunction with # cri-in-userns stage is for testing "CRI-in-UserNS", which should be used in conjunction with
# "Kubelet-in-UserNS": https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2033-kubelet-in-userns-aka-rootless # "Kubelet-in-UserNS": https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2033-kubelet-in-userns-aka-rootless
# This feature is mostly expected to be used for `kind` and `minikube`. # This feature is mostly expected to be used for `kind` and `minikube`.
@ -55,8 +60,8 @@ COPY contrib/Dockerfile.test.d/cri-in-userns/etc_containerd_config.toml /etc/con
COPY contrib/Dockerfile.test.d/cri-in-userns/docker-entrypoint.sh /docker-entrypoint.sh COPY contrib/Dockerfile.test.d/cri-in-userns/docker-entrypoint.sh /docker-entrypoint.sh
COPY --from=runc /build/ / COPY --from=runc /build/ /
COPY --from=cni /build/ / COPY --from=cni /build/ /
COPY --from=critools /build/ /
COPY . . COPY . .
RUN ./script/setup/install-critools
RUN make BUILDTAGS="no_btrfs no_devmapper" binaries install RUN make BUILDTAGS="no_btrfs no_devmapper" binaries install
VOLUME /var/lib/containerd VOLUME /var/lib/containerd
ENTRYPOINT ["/docker-entrypoint.sh"] ENTRYPOINT ["/docker-entrypoint.sh"]