Skip to contentSkip to conversation

Dockerfile: install-debian.sh: reduce image size

PATCH New Fathi Boudra 1 participant 1 message Apr 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Dockerfile: install-debian.sh: reduce image size

To reduce the image size, avoid to install recommended packages that can be unnecessary:
* Pass --no-install-recommends to apt-get.
* Pass -q=2 to reduce apt-get output noise.
* Add python-setuptools and python-wheel packages, previously pulled as recommends but are really required to build filelock.
* Replace gcc, g++ and make by the build-essential meta-package.
* Drop autoconf package, it's an automake dependency.

---
 Dockerfile           | 18 +++++++++---------
 Dockerfile.nojenkins | 16 ++++++++--------
 install-debian.sh    | 14 +++++++-------
 3 files changed, 24 insertions(+), 24 deletions(-)
Dockerfile +9 -9
index 6f1e2b6..364ac55 100644
@@ -37,20 +37,20 @@ RUN if [ -n "$HTTP_PROXY" ]; then echo 'Acquire::http::proxy "'$HTTP_PROXY'";' >
 # - python-pip: to install filelock, flake8
 # - filelock: parser
 RUN mkdir -p /usr/share/man/man1
-RUN apt-get update && apt-get -yV install \
+RUN apt-get update -q=2 && apt-get -q=2 -V --no-install-recommends install \
 	python-lxml python-simplejson python-yaml python-openpyxl \
 	python-requests python-reportlab python-parsedatetime \
-	python-pip
+	python-pip python-setuptools python-wheel
 RUN pip install filelock
 
 # Fuego command dependencies
-RUN apt-get update && apt-get -yV install \
+RUN apt-get -q=2 -V --no-install-recommends install \
 	git sshpass openssh-client sudo net-tools wget curl lava-tool \
 	bash-completion
 
 # Default SDK for testing locally or on an x86 board
-RUN apt-get update && apt-get -yV install \
-	gcc g++ make cmake bison flex autoconf automake libtool \
+RUN apt-get -q=2 -V --no-install-recommends install \
+	build-essential cmake bison flex automake libtool \
 	libelf-dev libssl-dev libsdl1.2-dev libcairo2-dev libxmu-dev \
 	libxmuu-dev libglib2.0-dev libaio-dev u-boot-tools pkg-config
 
@@ -61,7 +61,7 @@ RUN apt-get update && apt-get -yV install \
 # - python-xmltodict: AGL tests
 # - flake8: Functional.fuego_lint
 # FIXTHIS: install dependencies dynamically on the tests that need them
-RUN apt-get update && apt-get -yV install \
+RUN apt-get -q=2 -V --no-install-recommends install \
 	iperf iperf3 netperf bzip2 bc python-matplotlib python-xmltodict
 RUN pip install flake8
 
@@ -69,11 +69,11 @@ RUN pip install flake8
 # python-serial - used by serio
 # diffstat and vim - used by Tim
 # time - useful for timing command duration
-RUN apt-get update && apt-get -yV install \
+RUN apt-get -q=2 -V --no-install-recommends install \
     python-serial diffstat vim time
 
 # FIXTHIS: determine if these tools are really necessary
-#RUN apt-get update && apt-get -yV install \
+#RUN apt-get -q=2 -V --no-install-recommends install \
 #	apt-utils python-paramiko \
 #	xmlstarlet rsync \
 #	inotify-tools gettext netpipe-tcp \
@@ -100,7 +100,7 @@ ENV JENKINS_HOME=/var/lib/jenkins
 ENV JENKINS_PORT=$JENKINS_PORT
 
 # Jenkins dependencies
-RUN apt-get update && apt-get -yV install \
+RUN apt-get -q=2 -V --no-install-recommends install \
 	default-jdk daemon psmisc adduser procps unzip
 RUN pip install python-jenkins==0.4.14
 
Dockerfile.nojenkins +8 -8
index 19af85c..7f20879 100644
@@ -48,20 +48,20 @@ RUN if [ -n "$HTTP_PROXY" ]; then echo 'Acquire::http::proxy "'$HTTP_PROXY'";' >
 # - python-pip: to install filelock, flake8
 # - filelock: parser
 RUN mkdir -p /usr/share/man/man1
-RUN apt-get update && apt-get -yV install \
+RUN apt-get update -q=2 && apt-get -q=2 -V --no-install-recommends install \
 	python-lxml python-simplejson python-yaml python-openpyxl \
 	python-requests python-reportlab python-parsedatetime \
-	python-pip
+	python-pip python-setuptools python-wheel
 RUN pip install filelock
 
 # Fuego command dependencies
-RUN apt-get update && apt-get -yV install \
+RUN apt-get -q=2 -V --no-install-recommends install \
 	git sshpass openssh-client sudo net-tools wget curl lava-tool \
 	bash-completion
 
 # Default SDK for testing locally or on an x86 board
-RUN apt-get update && apt-get -yV install \
-	gcc g++ make cmake bison flex autoconf automake libtool \
+RUN apt-get -q=2 -V --no-install-recommends install \
+	build-essential cmake bison flex automake libtool \
 	libelf-dev libssl-dev libsdl1.2-dev libcairo2-dev libxmu-dev \
 	libxmuu-dev libglib2.0-dev libaio-dev u-boot-tools pkg-config
 
@@ -72,7 +72,7 @@ RUN apt-get update && apt-get -yV install \
 # - python-xmltodict: AGL tests
 # - flake8: Functional.fuego_lint
 # FIXTHIS: install dependencies dynamically on the tests that need them
-RUN apt-get update && apt-get -yV install \
+RUN apt-get -q=2 -V --no-install-recommends install \
 	iperf iperf3 netperf bzip2 bc python-matplotlib python-xmltodict
 RUN pip install flake8
 
@@ -80,11 +80,11 @@ RUN pip install flake8
 # python-serial - used by serio
 # diffstat and vim - used by Tim
 # time - useful for timing command duration
-RUN apt-get update && apt-get -yV install \
+RUN apt-get -q=2 -V --no-install-recommends install \
     python-serial diffstat vim time
 
 # FIXTHIS: determine if these tools are really necessary
-# RUN apt-get update && apt-get -yV install \
+# RUN apt-get -q=2 -V --no-install-recommends install \
 #	apt-utils python-paramiko \
 #	xmlstarlet rsync \
 #	inotify-tools gettext netpipe-tcp \
install-debian.sh +7 -7
index 790c484..bd03af9 100755
@@ -40,28 +40,28 @@ fi
 echo deb http://deb.debian.org/debian stretch main non-free > /etc/apt/sources.list
 echo deb http://security.debian.org/debian-security stretch/updates main >> /etc/apt/sources.list
 
-apt-get update
+apt-get update -q=2
 
 # Fuego python dependencies
-apt-get -yV install \
+apt-get -q=2 -V --no-install-recommends install \
 	python-lxml python-simplejson python-yaml python-openpyxl \
 	python-requests python-reportlab python-parsedatetime \
 	python-pip
 pip install filelock
 
 # Fuego command dependencies
-apt-get -yV install \
+apt-get -q=2 -V --no-install-recommends install \
 	git sshpass openssh-client sudo net-tools wget curl lava-tool \
 	bash-completion
 
 # Default SDK for testing locally or on an x86 board
-apt-get -yV install \
-	gcc g++ make cmake bison flex autoconf automake libtool \
+apt-get -q=2 -V --no-install-recommends install \
+	build-essential cmake bison flex automake libtool \
 	libelf-dev libssl-dev libsdl1.2-dev libcairo2-dev libxmu-dev \
 	libxmuu-dev libglib2.0-dev libaio-dev u-boot-tools pkg-config
 
 # Default test host dependencies
-apt-get -yV install \
+apt-get -q=2 -V --no-install-recommends install \
 	iperf iperf3 netperf bzip2 bc python-matplotlib python-xmltodict
 pip install flake8
 
@@ -97,7 +97,7 @@ if [ $nojenkins -eq 0 ]; then
 	JENKINS_PORT=$port
 
 	# Jenkins dependencies
-	apt-get -yV install \
+	apt-get -q=2 -V --no-install-recommends install \
 		default-jdk daemon psmisc adduser procps unzip
 	pip install python-jenkins==0.4.14
 
Signature · 1 line
2.20.1