dockerfiles/Dockerfile

41 lines
1.6 KiB
Docker
Raw Permalink Normal View History

2021-12-06 14:22:09 +01:00
FROM alpine:3.15 AS bootstrapper
2021-12-07 18:45:12 +01:00
ARG TARGETARCH
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 && \
2022-11-12 13:16:38 +01:00
/files/pacstrap-docker /rootfs base-devel git && \
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/ /
2022-11-12 13:16:38 +01:00
ENV LANG=en_US.UTF-8
2021-12-06 14:22:09 +01:00
RUN \
ln -sf /usr/lib/os-release /etc/os-release && \
pacman-key --init && \
pacman-key --populate && \
2022-10-19 22:04:20 +02:00
rm -rf /etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}* && \
# Enable LTO by default \
sed -i 's/!lto/lto/' /etc/makepkg.conf
2021-12-06 14:22:09 +01:00
CMD ["/usr/bin/bash"]