pacstrap: set up the image using NoExtract rules to prune dead weight

A docker container does not need tons of locales in order to do its job,
nor does it need extensive (or any) documentation.

With this change, a bare pacstrapped directory drops from 500MB to 390MB
This commit is contained in:
Eli Schwartz 2019-02-28 14:53:48 -05:00
parent e612e65be1
commit b6727d838f
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
3 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
*.orig
/.idea
/archlinux.tar
rootfs/etc/pacman.conf

View File

@ -4,7 +4,9 @@ DOCKER_IMAGE:=base
rootfs:
$(eval TMPDIR := $(shell mktemp -d))
env -i pacstrap -C /usr/share/devtools/pacman-extra.conf -c -d -G -M $(TMPDIR) $(shell cat packages)
cp /usr/share/devtools/pacman-extra.conf rootfs/etc/pacman.conf
cat pacman-conf.d-noextract.conf >> rootfs/etc/pacman.conf
env -i pacstrap -C rootfs/etc/pacman.conf -c -d -G -M $(TMPDIR) $(shell cat packages)
cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(TMPDIR)/
arch-chroot $(TMPDIR) locale-gen
arch-chroot $(TMPDIR) pacman-key --init

View File

@ -0,0 +1,9 @@
[options]
NoExtract = usr/share/help/* !usr/share/help/en*
NoExtract = usr/share/gtk-doc/html/* usr/share/doc/*
NoExtract = usr/share/locale/* usr/share/X11/locale/* usr/share/i18n/*
NoExtract = !*locale*/en*/* !usr/share/i18n/charmaps/UTF-8.gz !usr/share/*locale*/locale.*
NoExtract = !usr/share/*locales/en_?? !usr/share/*locales/i18n* !usr/share/*locales/iso*
NoExtract = !usr/share/*locales/trans*
NoExtract = usr/share/man/* usr/share/info/*
NoExtract = usr/share/vim/vim*/lang/*