Skip to content

Added cache for GHA Docker builds #1499

Added cache for GHA Docker builds

Added cache for GHA Docker builds #1499

name: Docker test build
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-image:
runs-on: ubuntu-latest
strategy:
matrix:
req_file:
- prod.txt
- tests.txt
# steps taken (and trimmed) from docker-publish.yml
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Test docker image build (local development)
uses: docker/build-push-action@v6
with:
context: .
push: false
build-args: |
REQ_FILE=requirements/${{ matrix.req_file }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-buildcache:bc-test-build-${{ matrix.req_file }}
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-buildcache:bc-test-build-${{ matrix.req_file }},mode=max