mirror of
https://gitlab.archlinux.org/archlinux/archlinux-docker.git
synced 2025-08-07 22:57:17 +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
|
FROM scratch
|
||||||
ADD archlinux.tar /
|
ADD archlinux.tar /
|
||||||
|
RUN locale-gen
|
||||||
|
RUN pacman-key --init && pacman-key --populate archlinux
|
||||||
ENV LANG=en_US.UTF-8
|
ENV LANG=en_US.UTF-8
|
||||||
CMD ["/usr/bin/bash"]
|
CMD ["/usr/bin/bash"]
|
||||||
|
16
Makefile
16
Makefile
@ -1,16 +1,16 @@
|
|||||||
DOCKER_USER:=pierres
|
DOCKER_USER:=pierres
|
||||||
DOCKER_ORGANIZATION=archlinux
|
DOCKER_ORGANIZATION=archlinux
|
||||||
DOCKER_IMAGE:=base
|
DOCKER_IMAGE:=base
|
||||||
|
BUILDDIR=build
|
||||||
|
|
||||||
rootfs:
|
rootfs:
|
||||||
$(eval TMPDIR := $(shell mktemp -d))
|
mkdir -vp $(BUILDDIR)/var/lib/pacman/
|
||||||
env -i pacstrap -C /usr/share/devtools/pacman-extra.conf -c -d -G -M $(TMPDIR) $(shell cat packages)
|
fakeroot -- pacman -Syu -r $(BUILDDIR) \
|
||||||
cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(TMPDIR)/
|
--noconfirm --dbpath $(PWD)/$(BUILDDIR)/var/lib/pacman \
|
||||||
arch-chroot $(TMPDIR) locale-gen
|
--hookdir rootfs/usr/share/libalpm/hooks/ $(shell cat packages)
|
||||||
arch-chroot $(TMPDIR) pacman-key --init
|
cp --recursive --preserve=timestamps --backup --suffix=.pacnew rootfs/* $(BUILDDIR)/
|
||||||
arch-chroot $(TMPDIR) pacman-key --populate archlinux
|
tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(BUILDDIR) -c . -f archlinux.tar
|
||||||
tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(TMPDIR) -c . -f archlinux.tar
|
rm -rf $(BUILDDIR)
|
||||||
rm -rf $(TMPDIR)
|
|
||||||
|
|
||||||
docker-image: rootfs
|
docker-image: rootfs
|
||||||
docker build -t $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) .
|
docker build -t $(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE) .
|
||||||
|
Loading…
Reference in New Issue
Block a user