Split GitHub Action cache to two directories

The GitHub Action workflow uses a cache to speed up the Docker builds.
However, it seems that it only partially works, saving only the Docker
layers for the Firefox build. This is an attempt to solve it by using
two separate cache paths, one for each build.
This commit is contained in:
lwthiker
2022-03-05 13:30:14 +02:00
parent 8468747057
commit ce95990620

View File

@@ -36,7 +36,9 @@ jobs:
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
path: |
/tmp/.buildx-cache-ff
/tmp/.buildx-cache-ch
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
@@ -47,8 +49,8 @@ jobs:
push: true
context: chrome/
tags: localhost:5000/curl-impersonate/chrome
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
cache-from: type=local,src=/tmp/.buildx-cache-ch
cache-to: type=local,dest=/tmp/.buildx-cache-ch-new,mode=max
- name: Build the Firefox version of curl-impersonate
uses: docker/build-push-action@v2
@@ -56,8 +58,8 @@ jobs:
push: true
context: firefox/
tags: localhost:5000/curl-impersonate/ff
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
cache-from: type=local,src=/tmp/.buildx-cache-ff
cache-to: type=local,dest=/tmp/.buildx-cache-ff-new,mode=max
- name: Build the tests container
uses: docker/build-push-action@v2
@@ -77,5 +79,7 @@ jobs:
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
rm -rf /tmp/.buildx-cache-ff
mv /tmp/.buildx-cache-ff-new /tmp/.buildx-cache-ff
rm -rf /tmp/.buildx-cache-ch
mv /tmp/.buildx-cache-ch-new /tmp/.buildx-cache-ch