Makefile 1.66 KB
Newer Older
1
DOCKER_USER:=pierres
2
3
DOCKER_ORGANIZATION=archlinux
DOCKER_IMAGE:=base
4
BUILDDIR=build
Pierre Schmitz's avatar
Pierre Schmitz committed
5

Pierre Schmitz's avatar
Pierre Schmitz committed
6
rootfs:
7
8
9
10
11
12
13
	mkdir -vp $(BUILDDIR)/var/lib/pacman/
	fakeroot -- pacman -Syu -r $(BUILDDIR) \
		--noconfirm --dbpath $(PWD)/$(BUILDDIR)/var/lib/pacman \
		--hookdir rootfs/usr/share/libalpm/hooks/ $(shell cat packages)
	cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(BUILDDIR)/
	tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(BUILDDIR) -c . -f archlinux.tar
	rm -rf $(BUILDDIR)
Pierre Schmitz's avatar
Pierre Schmitz committed
14
15

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

18
19
docker-image-test: docker-image
	# FIXME: /etc/mtab is hidden by docker so the stricter -Qkk fails
20
21
	docker run --rm $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) sh -c "/usr/bin/pacman -Sy && /usr/bin/pacman -Qqk"
	docker run --rm $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) sh -c "/usr/bin/pacman -Syu --noconfirm docker && docker -v"
22
	# Ensure that the image does not include a private key
23
	! docker run --rm $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) pacman-key --lsign-key pierre@archlinux.de
24
	docker run --rm $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) sh -c "/usr/bin/id -u http"
25
	docker run --rm $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) sh -c "/usr/bin/pacman -Syu --noconfirm grep && locale | grep -q UTF-8"
26

27
ci-test:
28
	docker run --rm --privileged --tmpfs=/tmp:exec --tmpfs=/run/shm -v /run/docker.sock:/run/docker.sock \
29
		-v $(PWD):/app -w /app $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) \
30
		sh -c 'pacman -Syu --noconfirm make devtools docker && make docker-image-test'
31

Pierre Schmitz's avatar
Pierre Schmitz committed
32
docker-push:
Pierre Schmitz's avatar
Pierre Schmitz committed
33
	docker login -u $(DOCKER_USER)
34
	docker push $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE)
Pierre Schmitz's avatar
Pierre Schmitz committed
35

36
.PHONY: rootfs docker-image docker-image-test ci-test docker-push