Repository navigation
Expand file tree
/
Copy pathDockerfile.arch
More file actions
64 lines (50 loc) · 2.95 KB
/
Copy pathDockerfile.arch
File metadata and controls
64 lines (50 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Stage 1: build arch-specific artifacts that must not ship with their build deps
# menci/archlinuxarm provides amd64 + arm64 + arm/v7 in a single multi-arch image.
FROM menci/archlinuxarm:latest AS builder
# pacman 7.0+ sandbox requires an 'alpm' user that doesn't exist in Docker.
# SigLevel=Never avoids keyring entropy/init issues under QEMU in CI.
# --overwrite '*' handles file conflicts from package splits (e.g. gcc-libs → libgcc+libstdc++).
RUN sed -i 's/^#DisableSandbox/DisableSandbox/' /etc/pacman.conf && \
sed -i '/^SigLevel[[:space:]]/c\SigLevel = Never' /etc/pacman.conf && \
sed -i '/^DisableSandbox/a NoExtract = etc/resolv.conf etc/hosts' /etc/pacman.conf && \
sed -i 's/^CheckSpace/#CheckSpace/' /etc/pacman.conf
RUN pacman -Syu --noconfirm --overwrite '*'
RUN pacman -S --noconfirm --needed --overwrite '*' glibc base-devel linux-api-headers busybox
RUN yes | pacman -Scc
COPY input/disableselinux.c /tmp/disableselinux.c
RUN mkdir /build \
&& gcc -shared -fPIC /tmp/disableselinux.c -o /build/libdisableselinux.so \
&& cp /usr/bin/busybox /build/busybox
# Stage 2: the real rootfs — no build toolchain
FROM menci/archlinuxarm:latest
RUN sed -i 's/^#DisableSandbox/DisableSandbox/' /etc/pacman.conf && \
sed -i '/^SigLevel[[:space:]]/c\SigLevel = Never' /etc/pacman.conf && \
sed -i '/^DisableSandbox/a NoExtract = etc/resolv.conf etc/hosts' /etc/pacman.conf && \
sed -i 's/^CheckSpace/#CheckSpace/' /etc/pacman.conf
RUN pacman -Syu --noconfirm --overwrite '*'
# systemd is a hard requirement of the AVF backend, not a convenience: avf-init
# pivot_roots into /lib/systemd/systemd and runs it as PID 1 when present, which
# is what makes `systemctl` -- and therefore Docker, podman and any packaged
# .service unit -- work inside the VM. Without it avf-init falls back to a
# chroot in which the distro's own init never runs. Requested explicitly even
# though the base image ships systemd as part of its base group: that is
# incidental, and an upstream change could silently regress it.
RUN pacman -S --noconfirm --needed --overwrite '*' \
systemd \
sudo dropbear sshfs x11vnc xterm xorg-twm xorg-server-xvfb xorg-xsetroot expect gzip
RUN yes | pacman -Scc
RUN printf '#!/bin/sh\nunset LD_PRELOAD\nunset LD_LIBRARY_PATH\nexport LIBGL_ALWAYS_SOFTWARE=1\n' \
> /etc/profile.d/userland.sh && chmod +x /etc/profile.d/userland.sh
RUN mkdir -p /usr/share/xsessions && \
printf '[Desktop Entry]\nEncoding=UTF-8\nName=Twm\nComment=This session logs you into Twm\nExec=twm\nType=Application\n' \
> /usr/share/xsessions/twm.desktop
COPY --from=builder /build/busybox /support/busybox
COPY --from=builder /build/libdisableselinux.so /support/libdisableselinux.so
COPY assets/common/ /support/
COPY assets/arch/ /support/
RUN chmod a+x /support/busybox \
/support/libdisableselinux.so \
/support/nosudo \
/support/*.sh \
&& chmod a-w /support/* \
&& chmod a-w /support