Skip to content

Commit 0092812

Browse files
authored
Merge pull request #24 from cloudstruct/fix/ci-cache
ci: update image caching mechanism
2 parents 1eca7dd + f1a4f8a commit 0092812

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

.github/workflows/ci-docker.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Docker CI
33
on:
44
pull_request:
55
branches: ['main']
6-
paths: ['Dockerfile','bin','config/**','.github/workflows/ci-docker.yml']
6+
paths: ['Dockerfile','bin/**','config/**','.github/workflows/ci-docker.yml']
77

88
env:
99
REGISTRY: ghcr.io
@@ -17,36 +17,69 @@ jobs:
1717
- name: qemu
1818
uses: docker/setup-qemu-action@v1
1919
- uses: docker/setup-buildx-action@v1
20+
- uses: actions/cache@v3
21+
with:
22+
path: /tmp/.buildx-cache
23+
key: ${{ runner.os }}-buildx-${{ github.sha }}
24+
restore-keys: |
25+
${{ runner.os }}-buildx-
2026
- id: meta
2127
uses: docker/metadata-action@v3
2228
with:
2329
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
30+
flavor: |
31+
latest=false
32+
suffix=-amd64
2433
- name: build
2534
uses: docker/build-push-action@v2
2635
with:
2736
context: .
2837
push: false
2938
tags: ${{ steps.meta.outputs.tags }}
3039
labels: ${{ steps.meta.outputs.labels }}
31-
cache-from: type=gha
32-
cache-to: type=gha,mode=max
40+
cache-from: type=local,src=/tmp/.buildx-cache
41+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
42+
# TEMP fix
43+
# https://github.com/docker/build-push-action/issues/252
44+
# https://github.com/moby/buildkit/issues/1896
45+
- name: cache
46+
run: |
47+
rm -rf /tmp/.buildx-cache
48+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
49+
3350
build-arm64:
3451
runs-on: self-hosted
3552
steps:
3653
- uses: actions/checkout@v2
3754
- name: qemu
3855
uses: docker/setup-qemu-action@v1
3956
- uses: docker/setup-buildx-action@v1
57+
- uses: actions/cache@v3
58+
with:
59+
path: /tmp/.buildx-cache
60+
key: ${{ runner.os }}-buildx-${{ github.sha }}
61+
restore-keys: |
62+
${{ runner.os }}-buildx-
4063
- id: meta
4164
uses: docker/metadata-action@v3
4265
with:
4366
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
67+
flavor: |
68+
latest=false
69+
suffix=-arm64v8
4470
- name: build
4571
uses: docker/build-push-action@v2
4672
with:
4773
context: .
4874
push: false
4975
tags: ${{ steps.meta.outputs.tags }}
5076
labels: ${{ steps.meta.outputs.labels }}
51-
cache-from: type=gha
52-
cache-to: type=gha,mode=max
77+
cache-from: type=local,src=/tmp/.buildx-cache
78+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
79+
# TEMP fix
80+
# https://github.com/docker/build-push-action/issues/252
81+
# https://github.com/moby/buildkit/issues/1896
82+
- name: cache
83+
run: |
84+
rm -rf /tmp/.buildx-cache
85+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 commit comments

Comments
 (0)