2017-04-10 15:19:21 +00:00
|
|
|
DOCKER_USER := 'pierres'
|
|
|
|
DOCKER_IMAGE := 'archlinux'
|
|
|
|
|
2017-04-08 16:10:19 +00:00
|
|
|
rootfs:
|
|
|
|
$(eval TMPDIR := $(shell mktemp -d))
|
2017-04-09 11:12:14 +00:00
|
|
|
pacstrap -C /usr/share/devtools/pacman-extra.conf -c -d -G -M $(TMPDIR) $(shell cat packages)
|
2017-04-15 19:14:45 +00:00
|
|
|
cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(TMPDIR)/
|
2017-04-08 16:10:19 +00:00
|
|
|
arch-chroot $(TMPDIR) locale-gen
|
|
|
|
arch-chroot $(TMPDIR) pacman-key --init
|
|
|
|
arch-chroot $(TMPDIR) pacman-key --populate archlinux
|
2017-04-10 15:19:21 +00:00
|
|
|
tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(TMPDIR) -c . -f archlinux.tar
|
2017-04-08 16:10:19 +00:00
|
|
|
rm -rf $(TMPDIR)
|
|
|
|
|
|
|
|
docker-image: rootfs
|
2017-04-10 15:19:21 +00:00
|
|
|
docker build -t $(DOCKER_USER)/$(DOCKER_IMAGE) .
|
|
|
|
|
2017-04-15 19:14:45 +00:00
|
|
|
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"
|
2017-04-23 13:11:34 +00:00
|
|
|
# Ensure that the image does not include a private key
|
|
|
|
! docker run --rm pierres/archlinux pacman-key --lsign-key pierre@archlinux.de
|
2017-04-15 19:14:45 +00:00
|
|
|
|
2017-04-23 13:36:09 +00:00
|
|
|
ci-test:
|
2017-04-23 14:09:01 +00:00
|
|
|
docker run --rm --privileged --tmpfs=/tmp:exec --tmpfs=/run/shm -v /var/run/docker.sock:/var/run/docker.sock -v $(PWD):/app -w /app pierres/archlinux \
|
2017-04-23 13:41:45 +00:00
|
|
|
sh -c 'pacman -Syu --noconfirm make devtools docker && make docker-image-test'
|
2017-04-23 13:36:09 +00:00
|
|
|
|
2017-04-15 19:14:45 +00:00
|
|
|
docker-push: docker-image-test
|
2017-04-10 15:19:21 +00:00
|
|
|
docker login -u $(DOCKER_USER)
|
|
|
|
docker push $(DOCKER_USER)/$(DOCKER_IMAGE)
|
2017-04-08 16:10:19 +00:00
|
|
|
|
2017-04-15 19:14:45 +00:00
|
|
|
.PHONY: rootfs docker-image docker-image-test docker-push
|