ci: store buildx cache in registry

This commit is contained in:
Quentin Gliech
2021-12-14 16:51:31 +01:00
parent 4ed47f26b6
commit f5be1d7f45
2 changed files with 18 additions and 6 deletions

View File

@@ -307,6 +307,8 @@ jobs:
name: Build and push Docker image
needs: [rustfmt, clippy]
runs-on: ubuntu-latest
env:
IMAGE: ghcr.io/matrix-org/matrix-authentication-service
steps:
- name: Checkout the code
@@ -316,7 +318,7 @@ jobs:
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/matrix-org/matrix-authentication-service
images: "${{ env.IMAGE }}"
bake-target: docker-metadata-action
tags: |
type=ref,event=branch
@@ -330,7 +332,7 @@ jobs:
id: meta-debug
uses: docker/metadata-action@v3
with:
images: ghcr.io/matrix-org/matrix-authentication-service
images: "${{ env.IMAGE }}"
bake-target: docker-metadata-action-debug
tags: |
type=ref,event=branch,suffix=-debug
@@ -362,8 +364,20 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
- name: Build
uses: docker/bake-action@v1
if: github.event_name == 'pull_request'
with:
targets: gha
set: gha-push.output=type=image,push=${{ github.event_name != 'pull_request' }}
set: |
gha-push.cache-from=type=registry,ref=${{ env.IMAGE }}:buildcache
- name: Build and push
uses: docker/bake-action@v1
if: github.event_name != 'pull_request'
with:
targets: gha
set: |
gha-push.output=type=image,push=true
gha-push.cache-from=type=registry,ref=${{ env.IMAGE }}:buildcache
gha-push.cache-to=type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max

View File

@@ -31,8 +31,6 @@ group "gha" { targets = ["gha-regular", "gha-debug", "gha-test"] }
target "gha-base" {
inherits = ["release"]
cache-from = ["type=gha"]
cache-to = ["type=gha,mode=max"]
}
// This is filled by GitHub Actions