mirror of
https://gitlab.archlinux.org/archlinux/archlinux-docker.git
synced 2025-08-06 22:27:29 +02:00
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.
This commit is contained in:
parent
eec02f2ea9
commit
0535b255ae
@ -1,4 +1,6 @@
|
||||
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"]
|
||||
|
16
Makefile
16
Makefile
@ -1,16 +1,16 @@
|
||||
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) .
|
||||
|
Loading…
Reference in New Issue
Block a user