From 80134c104416cc36c202e7a703c4761dcd64a0dc Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Wed, 9 Oct 2024 16:52:02 +0300 Subject: [PATCH] Updated the building process for better caching --- .github/workflows/benchmarking.yml | 35 ++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmarking.yml b/.github/workflows/benchmarking.yml index be184891c7..68db1442c2 100644 --- a/.github/workflows/benchmarking.yml +++ b/.github/workflows/benchmarking.yml @@ -23,7 +23,34 @@ jobs: run: "gcloud info" - name: Docker auth run: gcloud auth configure-docker europe-docker.pkg.dev --quiet - - name: Pull latest base image - run: docker pull electricsql/electric:canary - - name: Build image - run: docker build --push --cache-from=electricsql/electric:canary --tag ${{ env.REGISTRY }}/electric:${{ github.event.number }} . + - name: Pull latest base images + run: | + docker pull ${{ env.REGISTRY }}/electric:canary-builder || true + docker pull ${{ env.REGISTRY }}/electric:canary-runner-base || true + docker pull ${{ env.REGISTRY }}/electric:pr-${{ github.event.number }}-builder || true + docker pull ${{ env.REGISTRY }}/electric:pr-${{ github.event.number }}-runner-base || true + - name: Build base images + run: > + docker build + --push + --cache-from=${{ env.REGISTRY }}/electric:canary-builder + --cache-from=${{ env.REGISTRY }}/electric:pr-${{ github.event.number }}-builder + --tag ${{ env.REGISTRY }}/electric:pr-${{ github.event.number }}-builder + --target builder + . + + docker build + --push + --cache-from=${{ env.REGISTRY }}/electric:canary-runner-base + --cache-from=${{ env.REGISTRY }}/electric:pr-${{ github.event.number }}-runner-base + --tag ${{ env.REGISTRY }}/electric:pr-${{ github.event.number }}-runner-base + --target runner_setup + . + - name: Build actual image + run: > + docker build + --push + --cache-from=${{ env.REGISTRY }}/electric:pr-${{ github.event.number }}-builder + --cache-from=${{ env.REGISTRY }}/electric:pr-${{ github.event.number }}-runner-base + --tag ${{ env.REGISTRY }}/electric:pr-${{ github.event.number }}-${{ github.sha }} + .