From 22c9edfa67cbb8d86b1d866941c146cc0b16f23e Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Thu, 23 Jul 2020 01:33:05 -0700 Subject: [PATCH] lock debian sources to snapshots with auto retry --- config/container/Dockerfile | 15 +++++++++++---- config/container/sources.list | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 config/container/sources.list diff --git a/config/container/Dockerfile b/config/container/Dockerfile index 5f17025..dda1514 100644 --- a/config/container/Dockerfile +++ b/config/container/Dockerfile @@ -51,11 +51,18 @@ RUN chown root:root /usr/local/bin/fixuid \ && printf "user: build\ngroup: build\npaths:\n - /\n - /home/build/build\n" > /etc/fixuid/config.yml ENTRYPOINT ["/usr/local/bin/fixuid", "-q"] -## Install packages from packages.list +## Install packages from packages.list with retry +ADD config/container/sources.list /etc/apt/sources.list ADD config/container/packages.list /etc/apt/packages.list -RUN apt update -y \ - && apt install -y $(cat /etc/apt/packages.list) \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN echo ' \ + set -e; \ + apt-get update; \ + until apt-get install -y $(cat /etc/apt/packages.list); do \ + echo "apt install failed. Likely throttled. Retrying in 10 mins..."; \ + sleep 600; \ + done; \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*;' \ +| bash ## Create build user with sudo privs RUN useradd -G plugdev,sudo -ms /bin/bash build \ diff --git a/config/container/sources.list b/config/container/sources.list new file mode 100644 index 0000000..ffa6cf4 --- /dev/null +++ b/config/container/sources.list @@ -0,0 +1,3 @@ +deb http://snapshot.debian.org/archive/debian/20200722T000000Z buster main +deb http://snapshot.debian.org/archive/debian-security/20200722T000000Z buster/updates main +deb http://snapshot.debian.org/archive/debian/20200722T000000Z buster-updates main