Skip to content

Commit

Permalink
Refine cleaning, keep license documents
Browse files Browse the repository at this point in the history
  • Loading branch information
qiluo-msft committed Jun 1, 2016
1 parent 915f0fc commit 5ee19b9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
FROM debian:jessie

## Clean documentation in FROM image
RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true
## Clean doc directories that are empty or only contain empty directories
RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done
RUN rm -rf \
/usr/share/man/* \
/usr/share/groff/* \
/usr/share/info/* \
/usr/share/lintian/* \
/usr/share/linda/* \
/var/cache/man/* \
/usr/share/locale/*

## Set the apt source
COPY sources.list /etc/apt/sources.list
COPY dpkg_01_drop /etc/dpkg/dpkg.cfg.d/01_drop
RUN apt-get clean && apt-get update

## Pre-install the fundamental packages
Expand All @@ -20,4 +34,4 @@ RUN apt-get -y purge \

## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /usr/share/doc/* /usr/share/locale/* /var/lib/apt/lists/* /tmp/*
RUN rm -rf /var/lib/apt/lists/* /tmp/*
22 changes: 22 additions & 0 deletions dpkg_01_drop
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Drop unnecessary files
## ref: https://wiki.ubuntu.com/ReducingDiskFootprint

## Documentation
path-exclude /usr/share/doc/*
# we need to keep copyright files for legal reasons
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
# lintian stuff is small, but really unnecessary
path-exclude /usr/share/lintian/*
path-exclude /usr/share/linda/*

## Translations
path-exclude /usr/share/locale/*

## Landscape
path-exclude /usr/share/pyshared/twisted/test*
path-exclude /usr/lib/python*/dist-packages/twisted/test*
path-exclude /usr/share/pyshared/twisted/*/test*
path-exclude /usr/lib/python*/dist-packages/twisted/*/test*

0 comments on commit 5ee19b9

Please sign in to comment.