Skip to content

Commit

Permalink
Fix issue with docker layers caching
Browse files Browse the repository at this point in the history
  • Loading branch information
giorio94 committed May 15, 2021
1 parent af61e5a commit 5871b44
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,13 @@ jobs:
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ matrix.component }}-buildx-${{ hashFiles(format('{0}/**', matrix.context), matrix.dockerfile) }}
# The cache key is composed of the combination of the component name, the hash of the files in the build context and the hash of the commit.
# Example: Linux-instance-operator-buildx-78702f5342c365de6dec21db1910023b19d0c56b3e3187ac860131d88ac24498-3e0fbf49898789ec0ff0f78272dd0a7703389810
# The hash of the files in the context guarantees that a match is always found if no files of the component are modified, while the commit hash
# guarantees uniqueness of the name, to ensure the cache is always updated (i.e. to prevent issues if the base image changes).
key: ${{ runner.os }}-${{ matrix.component }}-buildx-${{ hashFiles(format('{0}/**', matrix.context), matrix.dockerfile) }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.component }}-buildx-${{ hashFiles(format('{0}/**', matrix.context), matrix.dockerfile) }}-
${{ runner.os }}-${{ matrix.component }}-buildx-
- name: Login to DockerHub
Expand Down

0 comments on commit 5871b44

Please sign in to comment.