From 015b6bd3c59d57c9b0cc3f2c2e06f8d2b6876441 Mon Sep 17 00:00:00 2001 From: Job79 Date: Mon, 29 Dec 2025 15:33:46 +0100 Subject: [PATCH] ci: add dnf cache --- .gitea/workflows/build.yaml | 4 ++++ containers/fedora/Containerfile | 5 ++--- containers/go/Containerfile | 2 +- containers/infra/Containerfile | 3 +-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 08ba1f4..a70315c 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -49,6 +49,8 @@ jobs: tags: ${{ github.ref_name }} context: ./containers/fedora containerfiles: ./containers/fedora/Containerfile + extra-args: | + --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 - name: Push uses: redhat-actions/push-to-registry@v2 with: @@ -96,6 +98,8 @@ jobs: context: ./containers/${{ matrix.container }} containerfiles: ./containers/${{ matrix.container }}/Containerfile build-args: TAG=${{ github.ref_name }} + extra-args: | + --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 - name: Push if: steps.check.outputs.run == 'true' uses: redhat-actions/push-to-registry@v2 diff --git a/containers/fedora/Containerfile b/containers/fedora/Containerfile index 2b78b15..8fac348 100644 --- a/containers/fedora/Containerfile +++ b/containers/fedora/Containerfile @@ -3,10 +3,9 @@ FROM quay.io/fedora/fedora:43 # === install system packages === RUN dnf update -y && \ dnf copr enable -y atim/lazygit && \ - dnf -y install procps ping bash-completion glibc-langpack-en \ + dnf -y --setopt=keepcache=1 install procps ping bash-completion glibc-langpack-en \ host-spawn dbus-launch \ - zoxide git npm neovim awk jq unzip fd-find lazygit && \ - dnf clean all + zoxide git npm neovim awk jq unzip fd-find lazygit # === setup user === RUN useradd -ms /bin/bash user && \ diff --git a/containers/go/Containerfile b/containers/go/Containerfile index 2e7222f..f28b864 100644 --- a/containers/go/Containerfile +++ b/containers/go/Containerfile @@ -2,6 +2,6 @@ ARG TAG FROM job79/fedora:${TAG} USER root -RUN dnf -y install go && dnf clean all +RUN dnf -y --setopt=keepcache=1 install go USER user diff --git a/containers/infra/Containerfile b/containers/infra/Containerfile index 0aad236..3670ec6 100644 --- a/containers/infra/Containerfile +++ b/containers/infra/Containerfile @@ -2,8 +2,7 @@ ARG TAG FROM job79/fedora:${TAG} USER root -RUN dnf -y install kubectl k9s openssl age "$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.assets[] | select(.name | test("sops-.*.x86_64.rpm$")) | .browser_download_url')" && \ - dnf clean all && \ +RUN dnf -y --setopt=keepcache=1 install kubectl k9s openssl age "$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.assets[] | select(.name | test("sops-.*.x86_64.rpm$")) | .browser_download_url')" && \ curl -sL https://talos.dev/install | sh && \ curl -s https://fluxcd.io/install.sh | bash