Unverified Commit 0535b255 authored by Santiago Torres's avatar Santiago Torres
Browse files

ENH: makefile/Dockerfile: allow for non-root build

The old makefile required commands to be run as a superuser, which
may become problematic when deploying on the archlinux infrastructure.
Use fakeroot and regular pacman commands to allow for to bootstrap a
rootfs.
parent eec02f2e
FROM scratch
ADD archlinux.tar /
RUN locale-gen
RUN pacman-key --init && pacman-key --populate archlinux
ENV LANG=en_US.UTF-8
CMD ["/usr/bin/bash"]
DOCKER_USER:=pierres
DOCKER_ORGANIZATION=archlinux
DOCKER_IMAGE:=base
BUILDDIR=build
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 --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(TMPDIR)/
arch-chroot $(TMPDIR) locale-gen
arch-chroot $(TMPDIR) pacman-key --init
arch-chroot $(TMPDIR) pacman-key --populate archlinux
tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(TMPDIR) -c . -f archlinux.tar
rm -rf $(TMPDIR)
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)
docker-image: rootfs
docker build -t $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) .
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment