From a5688cabe6833b9e2ec0e90d5409230b538c4294 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Thu, 20 Apr 2023 00:33:18 +0200 Subject: [PATCH] =?UTF-8?q?CI:=20cache=20Docker=20layers=20=F0=9F=92=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit db-rest equivalent of https://github.com/derhuerst/vbb-rest/commit/c8a06f0c6dc87e632ecd95b5f389f612b5df78fd --- .github/workflows/docker-image.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index de2c13b..1fffa71 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -26,23 +26,28 @@ jobs: steps: - name: check out the repo uses: actions/checkout@v2 + - name: configure Docker to use buildx + uses: docker/setup-buildx-action@v2 - name: log in to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_ACCESS_TOKEN }} - name: build Docker image & push to Docker Hub - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v4 with: context: . push: true tags: | derhuerst/db-rest:6 derhuerst/db-rest:latest + # https://docs.docker.com/build/ci/github-actions/examples/#github-cache + cache-from: type=gha + cache-to: type=gha,mode=max,oci-mediatypes=true,compression=zstd # this is for the public-transport/infrastructure cluster - name: log in to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -54,8 +59,11 @@ jobs: id: datetime run: echo "::set-output name=datetime::$(date -u +'%Y-%m-%dT%H.%M.%SZ')" - name: push Docker image to GitHub Registry - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v4 with: context: . push: true tags: ghcr.io/${{github.repository}}:v6_${{steps.hash.outputs.hash}}_${{steps.datetime.outputs.datetime}} + # https://docs.docker.com/build/ci/github-actions/examples/#github-cache + cache-from: type=gha + cache-to: type=gha,mode=max,oci-mediatypes=true,compression=zstd