Dockerfile.test: clean up apt indexes after installing

Not critical for intermediate stages, but a minor optimization to
reduce the image cache. Ideally, this would use cache-mounts for this,
but those may not be supported by podman, so taking the traditional
approach.

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

View File

@ -16,9 +16,9 @@ FROM golang:${GOLANG_VERSION} AS golang
# Install runc
FROM golang AS runc
RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends \
libseccomp-dev \
--no-install-recommends
&& rm -rf /var/lib/apt/lists/*
COPY script/setup/runc-version script/setup/install-runc ./
# Allow overriding the version of runc to install through build-args
@ -28,12 +28,12 @@ ARG DESTDIR=/build
RUN ./install-runc
FROM golang AS build-env
RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends \
libbtrfs-dev \
btrfs-progs \
libseccomp-dev \
xfsprogs \
--no-install-recommends
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /go/src/github.com/containerd/containerd
WORKDIR /go/src/github.com/containerd/containerd
@ -55,7 +55,9 @@ RUN GOBIN=$DESTDIR/usr/local/bin ./install-critools
# Requires Rootless Docker/Podman/nerdctl with cgroup v2 delegation: https://rootlesscontaine.rs/getting-started/common/cgroup2/
# (Rootless Docker/Podman/nerdctl prepares the UserNS, so we do not need to create UserNS by ourselves)
FROM build-env AS cri-in-userns
RUN apt-get update && apt-get install -y iptables
RUN apt-get update && apt-get install -y --no-install-recommends \
iptables \
&& rm -rf /var/lib/apt/lists/*
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 /build/ /
@ -78,7 +80,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
automake \
g++ \
libtool \
unzip
unzip \
&& rm -rf /var/lib/apt/lists/*
COPY script/setup/install-protobuf install-protobuf
RUN ./install-protobuf \