Commit 39b7e8b0c7d282b1a378299b8cdc30609fc499f5

Patrick Steinhardt 2019-08-02T12:26:30

docker: convert apt-get to use best practices Reformat both Xenial and Bionic's Dockerfiles to use best practices. Most importantly, we now run `apt-get update` and `apt-get install` in one step followed up by removing the package lists to speed up installation and keep down the image size.

diff --git a/azure-pipelines/docker/bionic b/azure-pipelines/docker/bionic
index 868d731..7980b8e 100644
--- a/azure-pipelines/docker/bionic
+++ b/azure-pipelines/docker/bionic
@@ -1,9 +1,23 @@
 ARG BASE
 FROM $BASE
-ARG CACHEBUST=1
-RUN apt-get update
-RUN apt-get -y install pkgconf clang git cmake curl libssl-dev libcurl4 libcurl4-openssl-dev libssh2-1-dev libz-dev valgrind openssh-client openssh-server
-RUN if [ "$ARCH" != "armhf" -a "$ARCH" != "arm64" ]; then apt-get -y install openjdk-11-jre-headless; fi
+RUN apt-get update && \
+    apt-get install -y \
+        clang \
+        cmake \
+        curl \
+        git \
+        libcurl4 \
+        libcurl4-openssl-dev \
+        libssh2-1-dev \
+        libssl-dev \
+        libz-dev \
+        openjdk-11-jre-headless \
+        openssh-client \
+        openssh-server \
+        pkgconf \
+        valgrind \
+        && \
+    rm -rf /var/lib/apt/lists/*
 RUN mkdir /var/run/sshd
 
 RUN cd /tmp && \
diff --git a/azure-pipelines/docker/xenial b/azure-pipelines/docker/xenial
index 847e201..9326799 100644
--- a/azure-pipelines/docker/xenial
+++ b/azure-pipelines/docker/xenial
@@ -1,8 +1,22 @@
 ARG BASE
 FROM $BASE
-ARG CACHEBUST=1
-RUN apt-get update
-RUN apt-get -y install pkgconf clang git cmake curl libssl-dev libcurl3 libcurl3-gnutls libcurl4-gnutls-dev valgrind openssh-client openssh-server openjdk-8-jre
+RUN apt-get update && \
+    apt-get install -y \
+        clang \
+        cmake \
+        curl \
+        git \
+        libcurl3 \
+        libcurl3-gnutls \
+        libcurl4-gnutls-dev \
+        libssl-dev \
+        openjdk-8-jre \
+        openssh-client \
+        openssh-server \
+        pkgconf \
+        valgrind \
+        && \
+    rm -rf /var/lib/apt/lists/*
 RUN mkdir /var/run/sshd
 
 RUN cd /tmp && \