Skip to content

Commit 8faacfc

Browse files
committed
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 <[email protected]>
1 parent 9f7e633 commit 8faacfc

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

contrib/Dockerfile.test

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ FROM golang:${GOLANG_VERSION} AS golang
1616

1717
# Install runc
1818
FROM golang AS runc
19-
RUN apt-get update && apt-get install -y \
19+
RUN apt-get update && apt-get install -y --no-install-recommends \
2020
libseccomp-dev \
21-
--no-install-recommends
21+
&& rm -rf /var/lib/apt/lists/*
2222

2323
COPY script/setup/runc-version script/setup/install-runc ./
2424
# Allow overriding the version of runc to install through build-args
@@ -28,12 +28,12 @@ ARG DESTDIR=/build
2828
RUN ./install-runc
2929

3030
FROM golang AS build-env
31-
RUN apt-get update && apt-get install -y \
31+
RUN apt-get update && apt-get install -y --no-install-recommends \
3232
libbtrfs-dev \
3333
btrfs-progs \
3434
libseccomp-dev \
3535
xfsprogs \
36-
--no-install-recommends
36+
&& rm -rf /var/lib/apt/lists/*
3737
RUN mkdir -p /go/src/github.com/containerd/containerd
3838
WORKDIR /go/src/github.com/containerd/containerd
3939

@@ -55,7 +55,9 @@ RUN GOBIN=$DESTDIR/usr/local/bin ./install-critools
5555
# Requires Rootless Docker/Podman/nerdctl with cgroup v2 delegation: https://rootlesscontaine.rs/getting-started/common/cgroup2/
5656
# (Rootless Docker/Podman/nerdctl prepares the UserNS, so we do not need to create UserNS by ourselves)
5757
FROM build-env AS cri-in-userns
58-
RUN apt-get update && apt-get install -y iptables
58+
RUN apt-get update && apt-get install -y --no-install-recommends \
59+
iptables \
60+
&& rm -rf /var/lib/apt/lists/*
5961
COPY contrib/Dockerfile.test.d/cri-in-userns/etc_containerd_config.toml /etc/containerd/config.toml
6062
COPY contrib/Dockerfile.test.d/cri-in-userns/docker-entrypoint.sh /docker-entrypoint.sh
6163
COPY --from=runc /build/ /
@@ -78,7 +80,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
7880
automake \
7981
g++ \
8082
libtool \
81-
unzip
83+
unzip \
84+
&& rm -rf /var/lib/apt/lists/*
8285

8386
COPY script/setup/install-protobuf install-protobuf
8487
RUN ./install-protobuf \

0 commit comments

Comments
 (0)