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 <admwiggin@gmail.com> (github: tianon)
| ... | ... |
@@ -95,6 +95,21 @@ if [ -d "$rootfsDir/etc/apt/apt.conf.d" ]; then |
| 95 | 95 |
|
| 96 | 96 |
Acquire::Languages "none"; |
| 97 | 97 |
EOF |
| 98 |
+ |
|
| 99 |
+ echo >&2 "+ echo Acquire::GzipIndexes 'true' > '$rootfsDir/etc/apt/apt.conf.d/docker-gzip-indexes'" |
|
| 100 |
+ cat > "$rootfsDir/etc/apt/apt.conf.d/docker-gzip-indexes" <<-'EOF' |
|
| 101 |
+ # Since Docker users using "RUN apt-get update && apt-get install -y ..." in |
|
| 102 |
+ # their Dockerfiles don't go delete the lists files afterwards, we want them to |
|
| 103 |
+ # be as small as possible on-disk, so we explicitly request "gz" versions and |
|
| 104 |
+ # tell Apt to keep them gzipped on-disk. |
|
| 105 |
+ |
|
| 106 |
+ # For comparison, an "apt-get update" layer without this on a pristine |
|
| 107 |
+ # "debian:wheezy" base image was "29.88 MB", where with this it was only |
|
| 108 |
+ # "8.273 MB". |
|
| 109 |
+ |
|
| 110 |
+ Acquire::GzipIndexes "true"; |
|
| 111 |
+ Acquire::CompressionTypes::Order:: "gz"; |
|
| 112 |
+ EOF |
|
| 98 | 113 |
fi |
| 99 | 114 |
|
| 100 | 115 |
if [ -z "$DONT_TOUCH_SOURCES_LIST" ]; then |