@@ -11,22 +11,30 @@ jobs:
1111 - name : Checkout
1212 uses : actions/checkout@v1
1313
14+ - name : Set up QEMU
15+ uses : docker/setup-qemu-action@v1
16+
17+ - name : Set up Docker Buildx
18+ uses : docker/setup-buildx-action@v1
19+
1420 - name : Set up Cloud SDK
1521 uses : google-github-actions/setup-gcloud@master
1622 with :
1723 project_id : monom-cicd-tools
1824 service_account_key : ${{ secrets.SA_KEY }}
1925 export_default_credentials : true
2026
21- - name : Set up QEMU
22- uses : docker/setup-qemu-action@v1
23-
24- - name : Set up Docker Buildx
25- uses : docker/setup-buildx-action@v1
26-
2727 - name : Docker login
2828 run : gcloud auth configure-docker
2929
30+ - name : Cache Docker layers
31+ uses : actions/cache@v2
32+ with :
33+ path : /tmp/.buildx-cache
34+ key : ${{ runner.os }}-buildx-${{ github.sha }}
35+ restore-keys : |
36+ ${{ runner.os }}-buildx-
37+
3038 - name : Build and push
3139 id : docker_build
3240 uses : docker/build-push-action@v2
3543 file : ./Dockerfile
3644 push : true
3745 tags : gcr.io/monom-cicd-tools/${{ github.event.repository.name }}:${{ github.event.release.tag_name }}
46+ cache-from : type=local,src=/tmp/.buildx-cache
47+ cache-to : type=local,dest=/tmp/.buildx-cache-new
48+ # This ugly bit is necessary if you don't want your cache to grow forever
49+ # till it hits GitHub's limit of 5GB.
50+ # Temp fix
51+ # https://github.com/docker/build-push-action/issues/252
52+ # https://github.com/moby/buildkit/issues/1896
53+
54+ - name : Move cache
55+ run : |
56+ rm -rf /tmp/.buildx-cache
57+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
3858
3959 - name : Slack notification
4060 uses : act10ns/slack@v1
0 commit comments