Skip to contentSkip to conversation

.gitlab-ci: Reduce Docker images size

PATCH In review Ramotowski, Maciej 2 participants 2 messages Feb 27, 2020 – Mar 5, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 .gitlab-ci: Reduce Docker images size

Make Dockerfile's more universal.

Reduce size of Ubuntu based images by removing package lists.

Add support for building with build cache and without --squash flag:

- Using apt-get update alone in a RUN statement causes caching issues and subsequent apt-get install instructions fail.

- When you run an image and generate a container, you add a new writable layer (the “container layer”) on top of the underlying layers. All changes made to the running container, such as writing new files, modifying existing files, and deleting files, are written to this thin writable container layer.

Cc Arkadiusz Hiler <[email protected]>
Cc Petri Latvala <[email protected]>
---
 Dockerfile.build-debian         | 39 +++++++---------
 Dockerfile.build-debian-arm64   | 68 ++++++++++++---------------
 Dockerfile.build-debian-armhf   | 67 ++++++++++++--------------
 Dockerfile.build-debian-minimal | 44 +++++++++--------
 Dockerfile.build-debian-mips    | 70 +++++++++++++--------------
 Dockerfile.build-fedora         | 83 ++++++++++++++++-----------------
 6 files changed, 172 insertions(+), 199 deletions(-)
Dockerfile.build-debian +17 -22
index b143a532..6cf7a1f0 100644
@@ -7,25 +7,20 @@ FROM $CI_REGISTRY_IMAGE/build-debian-minimal:commit-$CI_COMMIT_SHA
 # just few extra dependencies for building IGT with all the optional components
 # enabled
 
-RUN apt-get update
-RUN apt-get install -y \
-			libunwind-dev \
-			libgsl-dev \
-			libasound2-dev \
-			libxmlrpc-core-c3-dev \
-			libjson-c-dev \
-			libcurl4-openssl-dev \
-			python-docutils \
-			valgrind \
-			peg \
-			libdrm-intel1
-
-# autotools build deps
-RUN apt-get install -y \
-			autoconf \
-			automake \
-			xutils-dev \
-			libtool \
-			make
-
-RUN apt-get clean
+RUN apt-get update && apt-get install -y \
+    autoconf \
+    automake \
+    libasound2-dev \
+    libcurl4-openssl-dev \
+    libdrm-intel1 \
+    libgsl-dev \
+    libjson-c-dev \
+    libtool \
+    libunwind-dev \
+    libxmlrpc-core-c3-dev \
+    make \
+    peg \
+    python-docutils \
+    valgrind \
+    xutils-dev \
+ && rm -rf /var/lib/apt/lists/*
Dockerfile.build-debian-arm64 +31 -37

71 lines not on this page · raw message

Dockerfile.build-debian-armhf +31 -36

70 lines not on this page · raw message

Dockerfile.build-debian-minimal +21 -23

46 lines not on this page · raw message

Dockerfile.build-debian-mips +32 -38

74 lines not on this page · raw message

Dockerfile.build-fedora +40 -43

90 lines not on this page · raw message

Signature · 5 lines
2.17.1
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw
Quoted 15 lines · Maciej

Make Dockerfile's more universal.

Reduce size of Ubuntu based images by removing package lists.

Add support for building with build cache and without --squash flag:

- Using apt-get update alone in a RUN statement causes caching issues and subsequent apt-get install instructions fail.

- When you run an image and generate a container, you add a new writable layer (the “container layer”) on top of the underlying layers. All changes made to the running container, such as writing new files, modifying existing files, and deleting files, are written to this thin writable container layer.

Quoted 3 lines
Cc Arkadiusz Hiler <[email protected]>
Cc Petri Latvala <[email protected]>

Looks sensible. Thanks!

The patch does not apply though:
https://patchwork.freedesktop.org/series/74003/

Can you rebase it?

For some reason Fi.CI.BUILD had sending out the results disabled in patchwork. I have now enabled it.

Signature · 6 lines
Cheers,
Arek
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev