diff --git a/.github/workflows/publish-container.yml b/.github/workflows/publish-container.yml index ffa8c42327..ba5ecae9ac 100644 --- a/.github/workflows/publish-container.yml +++ b/.github/workflows/publish-container.yml @@ -27,3 +27,5 @@ jobs: with: push: true tags: smores56/smores-arch-toolbox:latest + cache-from: type=registry,ref=smores56/smores-arch-toolbox:buildcache + cache-to: type=registry,ref=smores56/smores-arch-toolbox:buildcache,mode=max diff --git a/Dockerfile b/Dockerfile index edb96cab68..f3dd1d75df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,24 @@ -FROM docker.io/imrehg/archlinux-makepkg:latest +######### +# Builder +######### +FROM archlinux AS base + +RUN pacman -Syuq --noconfirm git base-devel sudo + +RUN echo "Defaults lecture = never" > /etc/sudoers.d/privacy \ + && echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/wheel + +RUN useradd -m -G wheel builder && \ + cd /home/builder && \ + sudo -su builder git clone https://aur.archlinux.org/paru.git && \ + sudo -su builder makepkg -s --noconfirm -D paru && \ + mv * /tmp/paru && \ + userdel builder -rf + +######### +# Runtime +######### +FROM archlinux LABEL com.github.containers.toolbox="true" \ name="smores-arch-toolbox" \ @@ -6,6 +26,13 @@ LABEL com.github.containers.toolbox="true" \ usage="This image is meant to be used with the toolbox(1) command" \ summary="Image for creating Arch Toolbx containers" +RUN pacman -Syuq --noconfirm git base-devel sudo namcap openssh \ + && rm -rf /var/cache/pacman/pkg/* + +COPY --from=base /tmp/paru/*.pkg.tar.* /tmp/pkg/ + +RUN sudo pacman -U --noconfirm /tmp/pkg/*.pkg.tar.* + # Install Arch packages RUN yay -S --noconfirm --needed \ # terraform docker github-cli nixpkgs-fmt nil-git eza @@ -36,9 +63,3 @@ RUN fnm install --lts && \ vscode-langservers-extracted \ graphql-language-service-cli \ dockerfile-language-server-nodejs - -# Clear out /home -USER root -RUN sudo userdel -rf builder && \ - sudo rm -rf /home/* /var/home/* && \ - sudo mkdir /media