Makefile 1.18 KB
Newer Older
Pierre Schmitz's avatar
Pierre Schmitz committed
1
2
3
DOCKER_USER := 'pierres'
DOCKER_IMAGE := 'archlinux'

Pierre Schmitz's avatar
Pierre Schmitz committed
4
5
rootfs:
	$(eval TMPDIR := $(shell mktemp -d))
Pierre Schmitz's avatar
Pierre Schmitz committed
6
	pacstrap -C /usr/share/devtools/pacman-extra.conf -c -d -G -M $(TMPDIR) $(shell cat packages)
7
	cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(TMPDIR)/
Pierre Schmitz's avatar
Pierre Schmitz committed
8
9
10
	arch-chroot $(TMPDIR) locale-gen
	arch-chroot $(TMPDIR) pacman-key --init
	arch-chroot $(TMPDIR) pacman-key --populate archlinux
Pierre Schmitz's avatar
Pierre Schmitz committed
11
	tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(TMPDIR) -c . -f archlinux.tar
Pierre Schmitz's avatar
Pierre Schmitz committed
12
13
14
	rm -rf $(TMPDIR)

docker-image: rootfs
Pierre Schmitz's avatar
Pierre Schmitz committed
15
16
	docker build -t $(DOCKER_USER)/$(DOCKER_IMAGE) .

17
18
19
20
docker-image-test: docker-image
	# FIXME: /etc/mtab is hidden by docker so the stricter -Qkk fails
	docker run --rm $(DOCKER_USER)/$(DOCKER_IMAGE) sh -c "/usr/bin/pacman -Sy && /usr/bin/pacman -Qqk"
	docker run --rm $(DOCKER_USER)/$(DOCKER_IMAGE) sh -c "/usr/bin/pacman -Syu --noconfirm docker && docker -v"
21
22
	# Ensure that the image does not include a private key
	! docker run --rm pierres/archlinux pacman-key --lsign-key pierre@archlinux.de
23
24

docker-push: docker-image-test
Pierre Schmitz's avatar
Pierre Schmitz committed
25
26
	docker login -u $(DOCKER_USER)
	docker push $(DOCKER_USER)/$(DOCKER_IMAGE)
Pierre Schmitz's avatar
Pierre Schmitz committed
27

28
.PHONY: rootfs docker-image docker-image-test docker-push