Skip to content

Commit e1d8195

Browse files
committed
Auto merge of #105176 - klensy:docker-smol, r=Mark-Simulacrum
CI: reduce docker image sizes Reduces docker image sizes by using simple tips like: cleaning packet managers cache, squashing sequential installation steps into one. For some images this gives ~40mb for apt-based images (not so much), but ~200mb(!) for centos one.
2 parents 203c876 + eadf69a commit e1d8195

File tree

19 files changed

+43
-27
lines changed

19 files changed

+43
-27
lines changed

src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
1414
gdb \
1515
libssl-dev \
1616
pkg-config \
17-
xz-utils
17+
xz-utils \
18+
&& rm -rf /var/lib/apt/lists/*
1819

1920
COPY scripts/sccache.sh /scripts/
2021
RUN sh /scripts/sccache.sh

src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ RUN yum upgrade -y && \
3232
wget \
3333
xz \
3434
zlib-devel.i686 \
35-
zlib-devel.x86_64
35+
zlib-devel.x86_64 \
36+
&& yum clean all
3637

3738
RUN mkdir -p /rustroot/bin && ln -s /usr/bin/cmake3 /rustroot/bin/cmake
3839

src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1515
xz-utils \
1616
wget \
1717
libssl-dev \
18-
pkg-config
18+
pkg-config \
19+
&& rm -rf /var/lib/apt/lists/*
1920

2021
COPY scripts/freebsd-toolchain.sh /tmp/
2122
RUN /tmp/freebsd-toolchain.sh x86_64

src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ RUN apt-get update && \
1111
apt-get install -y --no-install-recommends \
1212
libgmp-dev \
1313
libmpfr-dev \
14-
libmpc-dev
14+
libmpc-dev \
15+
&& rm -rf /var/lib/apt/lists/*
1516

1617
COPY scripts/illumos-toolchain.sh /tmp/
1718

src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ RUN yum upgrade -y && \
3232
wget \
3333
xz \
3434
zlib-devel.i686 \
35-
zlib-devel.x86_64
35+
zlib-devel.x86_64 \
36+
&& yum clean all
3637

3738
RUN mkdir -p /rustroot/bin && ln -s /usr/bin/cmake3 /rustroot/bin/cmake
3839

src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
1616
gdb \
1717
patch \
1818
libssl-dev \
19-
pkg-config
19+
pkg-config \
20+
&& rm -rf /var/lib/apt/lists/*
2021

2122
WORKDIR /build/
2223

src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1515
gdb \
1616
zlib1g-dev \
1717
lib32z1-dev \
18-
xz-utils
18+
xz-utils \
19+
&& rm -rf /var/lib/apt/lists/*
1920

2021

2122
COPY scripts/sccache.sh /scripts/

src/ci/docker/host-x86_64/i686-gnu/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1515
gdb \
1616
zlib1g-dev \
1717
lib32z1-dev \
18-
xz-utils
18+
xz-utils \
19+
&& rm -rf /var/lib/apt/lists/*
1920

2021

2122
COPY scripts/sccache.sh /scripts/

src/ci/docker/host-x86_64/mingw-check/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2020
xz-utils \
2121
libssl-dev \
2222
pkg-config \
23-
mingw-w64
23+
mingw-w64 \
24+
&& rm -rf /var/lib/apt/lists/*
2425

2526
RUN curl -sL https://nodejs.org/dist/v16.9.0/node-v16.9.0-linux-x64.tar.xz | tar -xJ
2627
ENV PATH="/node-v16.9.0-linux-x64/bin:${PATH}"
2728
# Install es-check
2829
# Pin its version to prevent unrelated CI failures due to future es-check versions.
29-
RUN npm install es-check@6.1.1 -g
30-
RUN npm install eslint@8.6.0 -g
30+
RUN npm install es-check@6.1.1 eslint@8.6.0 -g
3131

3232
COPY scripts/sccache.sh /scripts/
3333
RUN sh /scripts/sccache.sh
3434

3535
COPY host-x86_64/mingw-check/reuse-requirements.txt /tmp/
36-
RUN pip3 install --no-deps --require-hashes -r /tmp/reuse-requirements.txt
36+
RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-requirements.txt
3737

3838
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
3939
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

src/ci/docker/host-x86_64/test-various/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
2121
ovmf \
2222
qemu-efi-aarch64 \
2323
qemu-system-arm \
24-
qemu-system-x86
24+
qemu-system-x86 \
25+
&& rm -rf /var/lib/apt/lists/*
2526

2627
RUN curl -sL https://nodejs.org/dist/v15.14.0/node-v15.14.0-linux-x64.tar.xz | \
2728
tar -xJ

0 commit comments

Comments
 (0)