# Making AUR work inside Dockerfile in non interactive way.(experiment) # Use an official Arch Linux runtime as a parent image FROM archlinux:latest # Maintainer LABEL maintainer="yourname@example.com" # Update system and install dependencies (we do not modify this step for docker caching) RUN pacman -Sy --noconfirm archlinux-keyring && \ pacman-key --init && \ pacman-key --populate archlinux && \ pacman -Syyu --noconfirm # Install more packages (as separate step to benefit from caching previous step) RUN pacman -S --needed --noconfirm base-devel git sudo go expac git jq sudo git perl make meson python fakechroot gtest # Set sudoers file for auruser RUN echo "auruser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/auruser # Clear package cache RUN pacman -Scc --noconfirm # Add a non-root user to avoid using root where possible RUN useradd -m -G wheel -s /bin/bash auruser USER auruser WORKDIR /home/auruser # Clone Yay and build package, print makepkg output for debugging RUN cd && git clone https://aur.archlinux.org/yay.git \ && cd yay \ && makepkg --noconfirm || (echo "makepkg failed with exit code $?"; exit 1) # After building yay, list the files in the directory RUN find /home/auruser -type f -name "*.pkg.tar.zst" # Add this line to stop the image build after the yay build step RUN touch ~/stop-here # Install the built package using sudo RUN sudo pacman -U /home/auruser/yay/yay-*.pkg.tar.zst --noconfirm \ && cd .. \ && rm -rf yay # Clone auracle-git and build package, print makepkg output for debugging USER auruser ENV PATH="/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin:${PATH}" RUN cd && git clone https://aur.archlinux.org/auracle-git.git \ && cd auracle-git \ && makepkg --noconfirm || (echo "makepkg failed with exit code $?"; exit 1) \ && sudo pacman -U /home/auruser/auracle-git/auracle-git-*.pkg.tar.zst --noconfirm \ && cd .. \ && rm -rf auracle-git # Clone pacaur and build package, print makepkg output for debugging RUN cd && git clone https://aur.archlinux.org/pacaur.git \ && cd pacaur \ && makepkg --noconfirm || (echo "makepkg failed with exit code $?"; exit 1) # After building pacaur, list the files in the directory RUN find /home/auruser -type f -name "*.pkg.tar.zst" # Install the built package using sudo RUN sudo pacman -U /home/auruser/pacaur/pacaur-*.pkg.tar.zst --noconfirm \ && cd .. \ && rm -rf pacaur # Extra tools that maybe convenient for user: USER root RUN pacman -S --needed --noconfirm vim neovim nano # Clean up USER root RUN pacman -Scc --noconfirm \ && rm -rf /home/auruser/.cache # Switch back to the auruser USER auruser WORKDIR /home/auruser RUN echo "export EDITOR=vim" >> ~/.bashrc #TODO make it so when one `alias docker-bash='eval $(docker build -q . | xargs -I % echo docker run -it % /bin/bash)'` then they will have $EDITOR=vim defined RUN EDITOR=cat pacaur --noconfirm -S paru-bin RUN EDITOR=cat yay --noconfirm -S spotify RUN EDITOR=cat pacaur --noconfirm -S aws-cli-v2 || EDITOR=cat yay --noconfirm -S aws-cli-v2 #RUN yay -h #RUN EDITOR=cat yay --noconfirm -S google-drive-ocamlfuse #RUN EDITOR=cat pacaur --noconfirm -S google-drive-ocamlfuse # Set the default command CMD ["/bin/bash"]