use cache

This commit is contained in:
Elio Bischof
2025-06-17 10:50:13 +02:00
parent 74ffb68296
commit 1977665ce6
2 changed files with 22 additions and 16 deletions

View File

@@ -10,18 +10,28 @@ jobs:
contents: "read" contents: "read"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/zitadel/login
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
git-branch={{branch}}
- name: Set up persistent Buildx builder - name: Set up persistent Buildx builder
id: buildx id: buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with:
install: true
driver: docker-container
use: true
- name: Build - name: Build
uses: docker/bake-action@v6 uses: docker/bake-action@v6
env:
GIT_BRANCH: ${{ fromJSON(steps.meta.outputs.json).labels['git-branch'] }}
with: with:
source: . source: .
push: false push: false
builder: ${{ steps.buildx.outputs.name }}
load: true
targets: login-lint targets: login-lint

View File

@@ -1,14 +1,10 @@
group "default" { target "docker-metadata-action" {}
targets = [
"login-lint",
]
}
variable "REGISTRY" { variable "IMAGE_REGISTRY" {
default = "ghcr.io/zitadel" default = "ghcr.io/zitadel"
} }
variable "GITHUB_REF_NAME" { variable "GIT_BRANCH" {
default = "local" default = "local"
} }
@@ -32,10 +28,10 @@ target "login-lint" {
login-dev-base = "target:login-dev-base" login-dev-base = "target:login-dev-base"
} }
cache-from = [ cache-from = [
"type=registry,ref=${REGISTRY}/login-lint-buildcache:${GITHUB_REF_NAME}", "type=registry,ref=${IMAGE_REGISTRY}/login-lint-buildcache:${GIT_BRANCH}",
"type=registry,ref=${REGISTRY}/login-lint-buildcache:main" "type=registry,ref=${IMAGE_REGISTRY}/login-lint-buildcache:main"
] ]
cache-to = ["type=registry,ref=${REGISTRY}/login-lint-buildcache:${GITHUB_REF_NAME},mode=max"] cache-to = ["type=registry,ref=${IMAGE_REGISTRY}/login-lint-buildcache:${GIT_BRANCH},mode=max"]
} }
variable "LOGIN_TEST_UNIT_TAG" { variable "LOGIN_TEST_UNIT_TAG" {