Files
containers/aurutils/Containerfile
2026-02-10 22:52:21 -05:00

74 lines
2.0 KiB
Docker

FROM docker.io/archlinux/archlinux:latest
# Update pacma dtaabase
# Initialize pacman key
# Ensure archlinux-keyring package is up to date
# Update all packages
RUN pacman -Sy && \
pacman-key --init && \
pacman -S --noconfirm archlinux-keyring && \
pacman -Su --noconfirm
# Install packages required for cloning and building the aur-utils repo
RUN pacman -S --noconfirm base-devel git curl jq man-db man-pages nano
# Install additional aurutils dependencies
# https://github.com/aurutils/aurutils/blob/release/makepkg/PKGBUILD#L14
RUN pacman -S --noconfirm pacutils trurl perl perl-json-xs
# Copy in makepkg config file, aur sudo ocnfig, custom repo config, and include custom repo config in main pacman config
COPY --chown=root:root --chmod=0664 makepkg.conf /etc/makepkg.conf.d/makepkg.conf
COPY --chown=root:root --chmod=0600 aur.sudo /etc/sudoers.d/aur
COPY --chown=root:root --chmod=0664 home.repo.conf /etc/pacman.d/home.repo.conf
RUN cat <<EOF >> /etc/pacman.conf
[home]
Include = /etc/pacman.d/home.repo.conf
EOF
# Create the aur system user
RUN useradd -r -U -m -d /aur aur && \
mkdir /repo && \
chmod 0775 /repo && \
chown aur:aur /repo
# Switch to aur user for build operations
USER aur
# Git clone the aur-utils repo
# Checkout the latest release, fetching latest release version from github API via curl
RUN git clone https://github.com/aurutils/aurutils.git /aur/aurutils && \
cd /aur/aurutils && \
git switch --detach $(curl -sSfL https://api.github.com/repos/aurutils/aurutils/releases/latest | jq -r .tag_name)
# Ensure makepkg dirs exist
RUN mkdir -p /aur/{builddir,srcdest,srcpkgdest,log}
# Init the home repo db
# Update pacman sources
RUN repo-add /repo/home.db.tar.zst && \
sudo pacman -Sy
# Build the aurutils package
RUN makepkg --nosign -i --noconfirm -D /aur/aurutils/makepkg
RUN rm /repo/aurutils-git*.pkg.tar.zst && \
rm -r /aur/aurutils
# Set working directory and entrypoint
WORKDIR /aur
ENV PATH=/usr/local/bin:/usr/bin
ENTRYPOINT ["/bin/bash"]