2021-12-06 14:22:09 +01:00
|
|
|
FROM alpine:3.15 AS bootstrapper
|
2021-12-07 18:45:12 +01:00
|
|
|
ARG TARGETARCH
|
2021-12-07 18:51:19 +01:00
|
|
|
ARG PACKAGE_GROUP=base
|
2021-12-07 18:45:12 +01:00
|
|
|
COPY files /files
|
2021-12-06 14:22:09 +01:00
|
|
|
RUN \
|
2021-12-07 18:45:12 +01:00
|
|
|
apk add arch-install-scripts pacman-makepkg curl && \
|
|
|
|
cat /files/repos-$TARGETARCH >> /etc/pacman.conf && \
|
2021-12-07 19:34:48 +01:00
|
|
|
mkdir -p /etc/pacman.d && \
|
|
|
|
cp /files/mirrorlist-$TARGETARCH /etc/pacman.d/mirrorlist && \
|
2021-12-07 18:45:12 +01:00
|
|
|
if [[ "$TARGETARCH" == "amd64" ]]; then \
|
|
|
|
apk add zstd && \
|
|
|
|
mkdir /tmp/archlinux-keyring && \
|
|
|
|
curl -L https://archlinux.org/packages/core/any/archlinux-keyring/download | unzstd | tar -C /tmp/archlinux-keyring -xv && \
|
|
|
|
mv /tmp/archlinux-keyring/usr/share/pacman/keyrings /usr/share/pacman/; \
|
|
|
|
elif [[ "$TARGETARCH" == "arm64" ]]; then \
|
|
|
|
curl -L https://github.com/archlinuxarm/archlinuxarm-keyring/archive/refs/heads/master.zip | unzip -d /tmp/archlinuxarm-keyring - && \
|
|
|
|
mkdir /usr/share/pacman/keyrings && \
|
|
|
|
mv /tmp/archlinuxarm-keyring/*/archlinuxarm* /usr/share/pacman/keyrings/; \
|
|
|
|
fi && \
|
2021-12-06 14:22:09 +01:00
|
|
|
pacman-key --init && \
|
|
|
|
pacman-key --populate && \
|
|
|
|
mkdir /rootfs && \
|
2021-12-07 18:45:12 +01:00
|
|
|
/files/pacstrap-docker /rootfs $PACKAGE_GROUP && \
|
2021-12-07 19:34:48 +01:00
|
|
|
cp /etc/pacman.d/mirrorlist /rootfs/etc/pacman.d/mirrorlist && \
|
2021-12-06 14:22:09 +01:00
|
|
|
echo "en_US.UTF-8 UTF-8" > /rootfs/etc/locale.gen && \
|
|
|
|
echo "LANG=en_US.UTF-8" > /rootfs/etc/locale.conf && \
|
|
|
|
chroot /rootfs locale-gen && \
|
2021-12-07 18:45:12 +01:00
|
|
|
rm -rf /rootfs/var/lib/pacman/sync/* /rootfs/files
|
2021-12-06 14:22:09 +01:00
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=bootstrapper /rootfs/ /
|
|
|
|
ENV LANG=en_US.UTF-8
|
|
|
|
RUN \
|
|
|
|
ln -sf /usr/lib/os-release /etc/os-release && \
|
|
|
|
pacman-key --init && \
|
|
|
|
pacman-key --populate && \
|
|
|
|
rm -rf /etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}*
|
|
|
|
|
|
|
|
CMD ["/usr/bin/bash"]
|