Skip to content

Commit dbd96b5

Browse files
Use github cache for docker
1 parent c44dcf2 commit dbd96b5

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

.github/workflows/build--timelapse.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,31 @@ jobs:
2323
with:
2424
username: ${{ secrets.DOCKER_USERNAME }}
2525
password: ${{ secrets.DOCKER_PASSWORD }}
26-
- name: build the image
27-
run: |
28-
docker buildx build --push \
29-
--tag ticklethepanda/rpi-timelapse:latest \
30-
--platform linux/arm/v7 ./rpi-timelapse
26+
- name: Cache Docker layers
27+
uses: actions/cache@v2
28+
with:
29+
path: /tmp/.buildx-cache
30+
key: ${{ runner.os }}-buildx-timelapse-${{ github.sha }}
31+
restore-keys: |
32+
${{ runner.os }}-buildx-timelapse-
33+
- name: Build and push
34+
uses:
35+
with:
36+
context: ./rpi-timelapse
37+
platforms: linux/arm/v7
38+
push: true
39+
tags: ticklethepanda/rpi-timelapse:latest
40+
cache-from: type=local,src=/tmp/.buildx-cache
41+
cache-to: type=local,dest=/tmp/.buildx-cache-new
3142
- name: Setup k8s context
3243
uses: azure/k8s-set-context@v1
3344
with:
3445
method: kubeconfig
3546
kubeconfig: ${{ secrets.KUBE_CONFIG }}
3647
- name: Rollout latest image
3748
run: kubectl rollout restart deployment/timelapse-deployment --namespace=home
49+
# prevent huge cache
50+
- name: Move cache
51+
run:
52+
rm -rf /tmp/.buildx-cache
53+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 commit comments

Comments
 (0)