From a4343af98ad801278412e641cff6db22bd49939b Mon Sep 17 00:00:00 2001
From: aviau <alexandre@alexandreviau.net>
Date: Mon, 25 Jul 2016 13:44:52 -0400
Subject: [PATCH] run apt-get clean before install/update

Running apt-get clean before an update/install should help to prevent
failures during installation. This will help to improve the build
stability.

Source:
 - https://stackoverflow.com/questions/35923576/debian-httpredir-mirror-system-unreliable-unusable-in-docker

Change-Id: Id7d6ee95cfec28af59311b4d9e6852ae5e5e4c8c
Tuleap: #873
---
 docker/Dockerfile_debian8          | 2 ++
 docker/Dockerfile_debian8_i386     | 2 ++
 docker/Dockerfile_debian9          | 2 ++
 docker/Dockerfile_debian9_i386     | 2 ++
 docker/Dockerfile_ubuntu14.04      | 2 ++
 docker/Dockerfile_ubuntu14.04_i386 | 2 ++
 docker/Dockerfile_ubuntu15.10      | 2 ++
 docker/Dockerfile_ubuntu15.10_i386 | 2 ++
 docker/Dockerfile_ubuntu16.04      | 2 ++
 docker/Dockerfile_ubuntu16.04_i386 | 2 ++
 scripts/build-package-debian.sh    | 1 +
 11 files changed, 21 insertions(+)

diff --git a/docker/Dockerfile_debian8 b/docker/Dockerfile_debian8
index bced958d..c7362f58 100644
--- a/docker/Dockerfile_debian8
+++ b/docker/Dockerfile_debian8
@@ -1,9 +1,11 @@
 FROM debian:8
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts equivs
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/docker/Dockerfile_debian8_i386 b/docker/Dockerfile_debian8_i386
index c0d2db01..333f015e 100644
--- a/docker/Dockerfile_debian8_i386
+++ b/docker/Dockerfile_debian8_i386
@@ -1,9 +1,11 @@
 FROM savoirfairelinux/ring-debian32:8
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts equivs
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/docker/Dockerfile_debian9 b/docker/Dockerfile_debian9
index ef32b438..93056f10 100644
--- a/docker/Dockerfile_debian9
+++ b/docker/Dockerfile_debian9
@@ -1,9 +1,11 @@
 FROM debian:stretch
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/docker/Dockerfile_debian9_i386 b/docker/Dockerfile_debian9_i386
index ed3bbdae..33e3903b 100644
--- a/docker/Dockerfile_debian9_i386
+++ b/docker/Dockerfile_debian9_i386
@@ -1,9 +1,11 @@
 FROM savoirfairelinux/ring-debian32:9
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/docker/Dockerfile_ubuntu14.04 b/docker/Dockerfile_ubuntu14.04
index 032d07db..b1f3655e 100644
--- a/docker/Dockerfile_ubuntu14.04
+++ b/docker/Dockerfile_ubuntu14.04
@@ -1,9 +1,11 @@
 FROM ubuntu:14.04
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts equivs
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/docker/Dockerfile_ubuntu14.04_i386 b/docker/Dockerfile_ubuntu14.04_i386
index 215ea7cc..5a2b396f 100644
--- a/docker/Dockerfile_ubuntu14.04_i386
+++ b/docker/Dockerfile_ubuntu14.04_i386
@@ -1,9 +1,11 @@
 FROM savoirfairelinux/ring-ubuntu32:14.04
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts equivs
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/docker/Dockerfile_ubuntu15.10 b/docker/Dockerfile_ubuntu15.10
index 34132a5d..cfeb2154 100644
--- a/docker/Dockerfile_ubuntu15.10
+++ b/docker/Dockerfile_ubuntu15.10
@@ -1,9 +1,11 @@
 FROM ubuntu:15.10
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts equivs
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/docker/Dockerfile_ubuntu15.10_i386 b/docker/Dockerfile_ubuntu15.10_i386
index be1187ea..0b323474 100644
--- a/docker/Dockerfile_ubuntu15.10_i386
+++ b/docker/Dockerfile_ubuntu15.10_i386
@@ -1,9 +1,11 @@
 FROM savoirfairelinux/ring-ubuntu32:15.10
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts equivs
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/docker/Dockerfile_ubuntu16.04 b/docker/Dockerfile_ubuntu16.04
index e3b46dcf..02821518 100644
--- a/docker/Dockerfile_ubuntu16.04
+++ b/docker/Dockerfile_ubuntu16.04
@@ -1,9 +1,11 @@
 FROM ubuntu:16.04
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts equivs
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/docker/Dockerfile_ubuntu16.04_i386 b/docker/Dockerfile_ubuntu16.04_i386
index 523ac65d..7e3936d5 100644
--- a/docker/Dockerfile_ubuntu16.04_i386
+++ b/docker/Dockerfile_ubuntu16.04_i386
@@ -1,9 +1,11 @@
 FROM savoirfairelinux/ring-ubuntu32:16.04
 
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y vim devscripts equivs
 
 # Speed up mk-build-deps
+RUN apt-get clean
 RUN apt-get update && \
     apt-get install -y -o Acquire::Retires=10 \
         autoconf \
diff --git a/scripts/build-package-debian.sh b/scripts/build-package-debian.sh
index 429f3c64..75b976da 100755
--- a/scripts/build-package-debian.sh
+++ b/scripts/build-package-debian.sh
@@ -35,6 +35,7 @@ else
 fi
 
 # install build deps
+apt-get clean
 apt-get update
 apt-get upgrade -o Acquire::Retires=10 -y
 mk-build-deps --remove --install debian/control -t "apt-get -y --no-install-recommends"
-- 
GitLab