kubernetes: minimise size of image cache images

The total size of the images in the common and control-plane cache is 251M and
528M respectively.

This changes drops the size of the cache images from 353M to 274M and from 630M
to 530M, reducing the overhead from ~100M to ~20M.

The initrd images shrink from 273M to 246M and from 416M to 363M (the initrd's
are compressed).

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2017-07-18 12:24:46 +01:00
parent 58227545b2
commit ee7d785b84

View File

@ -1,4 +1,21 @@
FROM docker:17.06.0-ce-dind
FROM docker:17.06.0-ce-dind AS docker
# Nothing to do in here, just for COPY --from=docker below
FROM linuxkit/alpine:9bcf61f605ef0ce36cc94d59b8eac307862de6e1 AS build
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
RUN apk add --no-cache --initdb -p /out \
alpine-baselayout \
busybox
# Remove apk residuals. We have a read-only rootfs, so apk is of no use.
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
FROM scratch
WORKDIR /
COPY --from=build /out /
COPY --from=docker /usr/local/bin/docker /usr/local/bin/docker
COPY *.tar /images/
ENTRYPOINT [ "/bin/sh", "-c" ]
CMD [ "for image in /images/*.tar ; do docker image load -i $image && rm -f $image ; done" ]