From dda9dff87f760396d21108a52e5e93c2e303c98d Mon Sep 17 00:00:00 2001 From: Leonardo Date: Fri, 10 Mar 2023 18:21:50 +0100 Subject: [PATCH] CI: Build using docker action Change to build the image using docker action, this should then allow the docker action's cache to be used. Subsequently reducing build time ~50%, as the image will only need to be built once. Currently image is built twice. The default driver uses double the disk space, see docker/build-push-action/issues/321 (in brief the image is build in the build-push-action local cache and then transfered to the local docker). This is a problem as this image is so large. Using the `docker` driver will workaround this. --- .github/workflows/docker-image.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 82722de8..5948dd31 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -60,6 +60,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c + with: + driver: docker - name: Pre build run: | @@ -90,13 +92,12 @@ jobs: # check disk space one more time df -h - - name: Build local docker image for test - # if: github.event_name != 'pull_request' - run: | - TAG=$GITHUB_SHA - docker build . \ - --file Dockerfile \ - --tag ${{ env.IMAGE_NAME}}:${{ env.TAG}} + - name: Build and load local docker image for test + uses: docker/build-push-action@v4 + with: + context: . + load: true + tags: ${{ env.IMAGE_NAME}}:${{ env.TAG}} - name: Inspect local docker image run: |