qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 04/23] docker: compact debian base


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 04/23] docker: compact debian base
Date: Mon, 8 May 2017 15:19:25 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 05/08/2017 08:04 AM, Alex Bennée wrote:

Philippe Mathieu-Daudé <address@hidden> writes:

- install common/basic tools at once
- one-line Emdebian setup
- use eatmydata and remove apt cache to save space
- add bison and flex and git

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 tests/docker/dockerfiles/debian.docker | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/tests/docker/dockerfiles/debian.docker 
b/tests/docker/dockerfiles/debian.docker
index 52bd79938e..694f8d3b63 100644
--- a/tests/docker/dockerfiles/debian.docker
+++ b/tests/docker/dockerfiles/debian.docker
@@ -9,17 +9,19 @@
 #
 FROM debian:stable-slim

-# Setup some basic tools we need
-RUN apt update
-RUN apt install -yy curl aptitude
-
-# Setup Emdebian
-RUN echo "deb http://emdebian.org/tools/debian/ jessie main" >> 
/etc/apt/sources.list
-RUN curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | 
apt-key add -
+# Install some basic tools and common build utilities
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -yy \
+        eatmydata && \

I wonder if we should just use ENV instead to set DEBIAN_FRONTEND?

In https://github.com/moby/moby/issues/4032#issuecomment-34597177 Tianon Gravi commented:

[...] setting it via ENV should be actively discouraged. [...]
The reason it's not a good default is that if I docker run -i -t ... bash, I'm now interactive, and this variable being set is very, very wrong.


+    DEBIAN_FRONTEND=noninteractive eatmydata apt-get install -y 
--no-install-recommends \
+        curl aptitude \
+        build-essential clang git \
+        bison flex && \
+    rm -rf /var/lib/apt

Use apt clean to do this.

Ok.


 # Duplicate deb line as deb-src
 RUN cat /etc/apt/sources.list | sed "s/deb/deb-src/" >> /etc/apt/sources.list

-# Install common build utilities
-RUN apt update
-RUN apt install -yy build-essential clang
+# Setup Emdebian
+RUN echo "deb http://emdebian.org/tools/debian/ jessie main" >> /etc/apt/sources.list 
&& \
+    curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | 
apt-key add -

Why move this to the end? Once we have curl installed it would be nice
to do just one update step and have emdebian synced up in the base
image.

In the first apt-get can install curl + build-essential clang in the same call, and there is no need to fetch emdebian.org index.

Using 'apt clean' at the end of a layer keeps smaller layer but the next layer have to call `apt-get update` again. Since this base image is used to cross-compile, the child image will have to call `dpkg --add-architecture ...` before fetching emdebian.org arch index again (apt-get update) to be able to install the `crossbuild-essential-$arch` package. So there is no need to update right after adding this repo, the 'child' will do it (and have to do it).


--
Alex Bennée




reply via email to

[Prev in Thread] Current Thread [Next in Thread]