From 314af37b3df42cb38d2e354fe07ef9ea998c7011 Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Sat, 8 Nov 2025 10:23:46 +1030 Subject: [PATCH] Workflow cache --- .gitea/workflows/build-and-push.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build-and-push.yaml b/.gitea/workflows/build-and-push.yaml index 8a56aab..ee5f188 100644 --- a/.gitea/workflows/build-and-push.yaml +++ b/.gitea/workflows/build-and-push.yaml @@ -48,7 +48,15 @@ jobs: registry: ${{ secrets.REGISTRY_HOST }} # e.g. registry.example.com username: ${{ secrets.REGISTRY_USER }} # e.g. admin password: ${{ secrets.REGISTRY_PASSWORD }} # e.g. - + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + # ------------------------------------------------------------------ # 4. Build the Docker image # ------------------------------------------------------------------ @@ -67,6 +75,8 @@ jobs: build-args: | # Add any build args here # ARG_NAME=VALUE + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache # ------------------------------------------------------------------ # 5. Push the image to the registry @@ -81,6 +91,8 @@ jobs: ${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.sha }} ${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:${{ github.ref_name }} ${{ vars.REGISTRY_HOST }}/${{ steps.github_repository_to_lowercase.outputs.lowercase }}:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache # ------------------------------------------------------------------ # 6. (Optional) Clean up local Docker cache