From 245de581f3aaf5f4207bfc064f73536db3219029 Mon Sep 17 00:00:00 2001 From: Ernesto Serrano Date: Tue, 5 Aug 2025 10:32:27 +0100 Subject: [PATCH] chore: cache Docker images in CI --- .github/workflows/ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5825c25..786f1d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,17 @@ jobs: - name: Lint run: make lint + - name: Cache Docker images + uses: actions/cache@v4 + with: + path: /tmp/docker-cache + key: ${{ runner.os }}-docker-${{ hashFiles('docker-compose.yml') }} + + - name: Load cached Docker images + run: | + if [ -f /tmp/docker-cache/postgres.tar ]; then docker load -i /tmp/docker-cache/postgres.tar; fi + if [ -f /tmp/docker-cache/moodle.tar ]; then docker load -i /tmp/docker-cache/moodle.tar; fi + - name: Start Moodle with Docker Compose (in backgroud) run: make upd @@ -42,3 +53,10 @@ jobs: - name: Run example_script.py run: python example_script.py + - name: Save Docker images to cache + if: always() + run: | + mkdir -p /tmp/docker-cache + docker save postgres:alpine -o /tmp/docker-cache/postgres.tar + docker save erseco/alpine-moodle:v4.5.5 -o /tmp/docker-cache/moodle.tar +