From 2e61e8267ea6a668d728fe72406619075330a26a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 16 Jul 2014 14:58:02 -0600 Subject: [PATCH] Add "Acquire::GzipIndexes" to contrib/mkimage/debootstrap This results in a dramatic improvement in the size of individual "apt-get update" layers (on a clean wheezy base, from "29.88 MB" down to "8.273 MB"). Docker-DCO-1.1-Signed-off-by: Andrew Page (github: tianon) --- contrib/mkimage/debootstrap | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/contrib/mkimage/debootstrap b/contrib/mkimage/debootstrap index 6f0cadd3c9..78afe50bb2 100755 --- a/contrib/mkimage/debootstrap +++ b/contrib/mkimage/debootstrap @@ -95,6 +95,21 @@ if [ -d "$rootfsDir/etc/apt/apt.conf.d" ]; then Acquire::Languages "none"; EOF + + echo >&2 "+ echo Acquire::GzipIndexes 'true' > '$rootfsDir/etc/apt/apt.conf.d/docker-gzip-indexes'" + cat > "$rootfsDir/etc/apt/apt.conf.d/docker-gzip-indexes" <<-'EOF' + # Since Docker users using "RUN apt-get update && apt-get install -y ..." in + # their Dockerfiles don't go delete the lists files afterwards, we want them to + # be as small as possible on-disk, so we explicitly request "gz" versions and + # tell Apt to keep them gzipped on-disk. + + # For comparison, an "apt-get update" layer without this on a pristine + # "debian:wheezy" base image was "29.88 MB", where with this it was only + # "8.273 MB". + + Acquire::GzipIndexes "true"; + Acquire::CompressionTypes::Order:: "gz"; + EOF fi if [ -z "$DONT_TOUCH_SOURCES_LIST" ]; then