FROM archlinux:base-devel
# Update keyring first to avoid GPG errors on a fresh Arch image,
# then upgrade the system and install Rust and core dependencies;
# suitesparse is installed without blas-openblas because MKL will be used instead
RUN pacman -Sy --noconfirm archlinux-keyring && \
pacman -Syu --noconfirm rust
# Create a non-root user for building and testing
RUN useradd -m user
# Give user password-less sudo so yay/makepkg can install AUR packages
RUN echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Copy project files; --chown ensures the destination directory and all
# files are owned by user, so cargo can write target/ during the build
COPY --chown=user:user . /usr/local/src/gemlab/
WORKDIR /usr/local/src/gemlab
# Install the Intel oneAPI toolkit (MKL + compilers);
# must run as root because pacman needs it
RUN bash zscripts/arch-install-intel-toolkit.bash
# Install metis from Chaotic-AUR (pre-built AUR packages);
# must run as root because pacman needs it
RUN bash -c "pacman-key --init && \
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com && \
pacman-key --lsign-key 3056513887B78AEB && \
pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' && \
pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' && \
echo >> /etc/pacman.conf && \
echo '[chaotic-aur]' >> /etc/pacman.conf && \
echo 'Include = /etc/pacman.d/chaotic-mirrorlist' >> /etc/pacman.conf && \
pacman -Sy --noconfirm metis"
# Compile and install MUMPS with Intel MKL backend;
# must run as root because pacman and ldconfig need it
RUN bash zscripts/arch-compile-mumps.bash 1
# Compile and install SuiteSparse as well (with Intel MKL)
RUN bash zscripts/arch-compile-suitesparse.bash 1
# Set the user
USER user
# MKL requires sourcing setvars.sh in the same shell as cargo test
ENV RUST_BACKTRACE=1
RUN bash -c "source /opt/intel/oneapi/setvars.sh && cargo test --features intel_mkl,local_sparse"