Skip to content

Commit

Permalink
chore(ci): Docker base image layers caching
Browse files Browse the repository at this point in the history
- Cache base image layers only
- Cache for verify job only
- Do not cache for publish job since:
  - most of the work is cross compiling
  - go.mod often change between publish jobs
  - prevent bugs introduced due to the cache (unlikely)
  • Loading branch information
qdm12 committed Jun 17, 2023
1 parent 336bf05 commit f15e3e5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,32 @@ jobs:
locale: "US"
level: error

- uses: docker/setup-buildx-action@v2

- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and cache base image layers
uses: docker/build-push-action@v4
with:
target: base
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
if: always()
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Linting
run: docker build --target lint .

Expand Down

0 comments on commit f15e3e5

Please sign in to comment.