Skip to content

Commit

Permalink
saner
Browse files Browse the repository at this point in the history
  • Loading branch information
Azathothas committed Dec 25, 2024
1 parent 3ec9685 commit c26aa5f
Showing 1 changed file with 50 additions and 19 deletions.
69 changes: 50 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,71 @@
#FROM ghcr.io/fwcd/archlinux:latest AS bootstrap
FROM azathothas/archlinux:latest AS bootstrap
FROM pkgforge/archlinux:latest AS bootstrap

#------------------------------------------------------------------------------------#
##Build Args
ARG TARGETARCH
ARG TARGETVARIANT
#------------------------------------------------------------------------------------#

# Set up the bootstrap tree
#------------------------------------------------------------------------------------#
##Bootstrap
COPY /bootstrap/any /
COPY /bootstrap/${TARGETARCH}${TARGETVARIANT} /

# Set up the initial rootfs tree
COPY /rootfs/any /rootfs
COPY /rootfs/${TARGETARCH}${TARGETVARIANT} /rootfs
#------------------------------------------------------------------------------------#

# Install the base packages
RUN cat /etc/bootstrap-packages.txt | xargs pacstrap-docker /rootfs
#------------------------------------------------------------------------------------#
##Install the base packages
RUN cat /etc/bootstrap-packages.txt | xargs pacstrap-docker /rootfs 2>/dev/null
#------------------------------------------------------------------------------------#

#------------------------------------------------------------------------------------#
##Fixes
# Fix marginal trust errors on Arch Linux ARM
RUN sed -i 's/^\(GPG_PACMAN=(.*\))/\1 --allow-weak-key-signatures)/g' /rootfs/usr/bin/pacman-key

# Remove the current pacman database (usually outdated very soon anyway)
RUN rm /rootfs/var/lib/pacman/sync/*
RUN <<EOS
set +e
sed -i 's/^\(GPG_PACMAN=(.*\))/\1 --allow-weak-key-signatures)/g' "/rootfs/usr/bin/pacman-key" 2>/dev/null || true
rm /rootfs/var/lib/pacman/sync/* 2>/dev/null || true
sed 's/DownloadUser/#DownloadUser/g' -i "/etc/pacman.conf" 2>/dev/null || true
EOS
#------------------------------------------------------------------------------------#

#------------------------------------------------------------------------------------#
##Copy the bootstrapped rootfs
FROM scratch

# Copy the bootstrapped rootfs
COPY --from=bootstrap /rootfs /
#------------------------------------------------------------------------------------#

# Set up locale
ENV LANG=en_US.UTF-8
RUN locale-gen

#------------------------------------------------------------------------------------#
##Initialize
# Set up pacman-key without distributing the lsign key
# See https://gitlab.archlinux.org/archlinux/archlinux-docker/-/blob/301942f9e5995770cb5e4dedb4fe9166afa4806d/README.md#principles
# Source: https://gitlab.archlinux.org/archlinux/archlinux-docker/-/blob/301942f9e5995770cb5e4dedb4fe9166afa4806d/Makefile#L22
RUN pacman-key --init && \
pacman-key --populate && \
bash -c "rm -rf etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}*"
RUN <<EOS
set +e
pacman-key --init 2>/dev/null || true
pacman-key --populate 2>/dev/null || true
bash -c "rm -rf etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}*" 2>/dev/null || true
sed 's/DownloadUser/#DownloadUser/g' -i "/etc/pacman.conf" 2>/dev/null || true
EOS
#------------------------------------------------------------------------------------#

#------------------------------------------------------------------------------------#
#ENV
RUN <<EOS
#Locale
echo "LC_ALL=en_US.UTF-8" | tee -a "/etc/environment"
echo "en_US.UTF-8 UTF-8" | tee -a "/etc/locale.gen"
echo "LANG=en_US.UTF-8" | tee -a "/etc/locale.conf"
locale-gen "en_US.UTF-8"
EOS
ENV LANG="en_US.UTF-8"
ENV LANGUAGE="en_US:en"
ENV LC_ALL="en_US.UTF-8"
#------------------------------------------------------------------------------------#

#------------------------------------------------------------------------------------#
#Entrypoint
CMD ["/usr/bin/bash"]
#------------------------------------------------------------------------------------#

0 comments on commit c26aa5f

Please sign in to comment.