docker / docker/build-push-action

Pretty big cache

Open
#252 32 comments 32 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/buildkit area/cache kind/upstream
Dominant language
TypeScript
Stars
5.4k
Forks
735
Avg merge
3d 9h
Merged PRs (30d)
14

Description

Description

The cache can grow very quickly with large images, since old entries are not deleted.

Configuration
[...]

      - name: Cache Docker layers
        uses: actions/cache@v2
        with:
          path: /tmp/.buildx-cache
          key: ${{ runner.os }}-buildx-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-buildx-

[...]

      - name: Build
        uses: docker/build-push-action@v2
        with:
          push: false
          tags: ${{ steps.prepare.outputs.image }}
          platforms: ${{ env.DOCKER_PLATFORMS }}
          cache-from: type=local,src=/tmp/.buildx-cache
          cache-to: type=local,dest=/tmp/.buildx-cache
          context: .

[...]
Logs

logs_37.zip

My solution

Add a clean-cache configuration option that runs the following command before exporting the layers docker system prune -f --filter "until=5h".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cache and Build steps in .github/workflows/docker-publish.yml, then review the linked logs and the issue discussion for the action's current cache behavior. Done means the action exposes the proposed clean-cache configuration and runs the cleanup before exporting layers without allowing the cache to grow indefinitely.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, github-actions, typescript
Domain
build-system, ci-cd
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.