Skip to content

Commit

Permalink
Use GitHub Actions cache API for build image caching
Browse files Browse the repository at this point in the history
  • Loading branch information
lecafard committed Jun 21, 2024
1 parent 2d4a460 commit 97813e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v1

- 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: docker buildx build and push
run: ./scripts/build-and-push-changed.sh

- name: move and delete old cache
run: rm -rf /tmp/.buildx-cache && mv /tmp/.buildx-cache-new /tmp/.buildx-cache
4 changes: 2 additions & 2 deletions scripts/build-and-push-changed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ for project in `get_changed_compose_projects`; do
(
cd "$project"
docker buildx bake --push \
--set '*.cache-from=type=local,src=/tmp/.buildx-cache' \
--set '*.cache-to=type=local,mode=max,dest=/tmp/.buildx-cache-new' \
--set '*.cache-from=type=gha' \
--set '*.cache-to=type=gha,mode=max' \
-f docker-compose.yml
)
done

0 comments on commit 97813e0

Please sign in to comment.