feat(ci): use docker registry cache (#8544)

This commit is contained in:
Harshal Sheth 2023-08-02 15:17:13 -07:00 committed by GitHub
parent 637a6aef18
commit e157992b77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ runs:
# add git short SHA as Docker tag # add git short SHA as Docker tag
tag-custom: ${{ inputs.tags }} tag-custom: ${{ inputs.tags }}
tag-custom-only: true tag-custom-only: true
# Code for testing the build when not pushing to Docker Hub. # Code for testing the build when not pushing to Docker Hub.
- name: Build and Load image for testing (if not publishing) - name: Build and Load image for testing (if not publishing)
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
@ -64,12 +64,14 @@ runs:
tags: ${{ steps.docker_meta.outputs.tags }} tags: ${{ steps.docker_meta.outputs.tags }}
load: true load: true
push: false push: false
cache-from: type=registry,ref=${{ steps.docker_meta.outputs.tags }}
cache-to: type=inline
- name: Upload image locally for testing (if not publishing) - name: Upload image locally for testing (if not publishing)
uses: ishworkh/docker-image-artifact-upload@v1 uses: ishworkh/docker-image-artifact-upload@v1
if: ${{ inputs.publish != 'true' }} if: ${{ inputs.publish != 'true' }}
with: with:
image: ${{ steps.docker_meta.outputs.tags }} image: ${{ steps.docker_meta.outputs.tags }}
# Code for building multi-platform images and pushing to Docker Hub. # Code for building multi-platform images and pushing to Docker Hub.
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
@ -93,5 +95,7 @@ runs:
build-args: ${{ inputs.build-args }} build-args: ${{ inputs.build-args }}
tags: ${{ steps.docker_meta.outputs.tags }} tags: ${{ steps.docker_meta.outputs.tags }}
push: true push: true
cache-from: type=registry,ref=${{ steps.docker_meta.outputs.tags }}
cache-to: type=inline
# TODO add code for vuln scanning? # TODO add code for vuln scanning?