# HG changeset patch # User Edouard Tisserant # Date 1653047991 -7200 # Node ID 399397ddd56871ab5a809db8793a1822b390f5b8 # Parent ef2720b6f78e77c1475cdfe8d8387ca530392149 GH Actions: Add caching for Docker image diff -r ef2720b6f78e -r 399397ddd568 .github/workflows/build_bundles.yml --- a/.github/workflows/build_bundles.yml Fri May 20 13:40:04 2022 +0200 +++ b/.github/workflows/build_bundles.yml Fri May 20 13:59:51 2022 +0200 @@ -55,11 +55,26 @@ canfestival ${{ env.canfestival_revisionid }} EOF - # TODO: cache docker image, find files to hash for a key - - name: Create docker image + - name: Cache docker image + id: cache-docker + uses: actions/cache@v3 + env: + cache-name: cache-docker + with: + path: /tmp/latest.tar + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('beremiz_public_dist/Dockerfile', 'beremiz_public_dist/*.sh') }} + + - if: ${{ steps.cache-docker.outputs.cache-hit == false }} + name: Create docker image run: | cd beremiz_public_dist ./build_docker_image.sh + docker image save --output="/tmp/latest.tar" beremiz_public_builder + + - if: ${{ steps.cache-docker.outputs.cache-hit != false }} + name: Re-use docker image + run: | + docker image load --input="/tmp/latest.tar" - name: Create docker container run: |