2025-02-18 17:40:41 +01:00
|
|
|
variable "GITHUB_SHA" {
|
|
|
|
default = "latest"
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "REGISTRY" {
|
2025-02-19 01:02:12 +01:00
|
|
|
default = "ghcr.io/zitadel"
|
2025-02-18 22:43:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
group "build" {
|
|
|
|
targets = ["console-build", "core-build"]
|
|
|
|
}
|
|
|
|
|
|
|
|
group "output" {
|
|
|
|
targets = ["console-output", "core-output"]
|
2025-02-18 17:40:41 +01:00
|
|
|
}
|
|
|
|
|
2025-02-19 10:12:00 +01:00
|
|
|
group "lint" {
|
|
|
|
targets = ["console-lint", "core-lint"]
|
|
|
|
}
|
|
|
|
|
2025-02-19 01:02:12 +01:00
|
|
|
group "image" {
|
|
|
|
targets = ["console-image", "core-image"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "_console" {
|
|
|
|
dockerfile = "Dockerfile.console"
|
|
|
|
context = "."
|
|
|
|
contexts = {
|
|
|
|
node = "docker-image://node:22"
|
|
|
|
nginx = "docker-image://nginx:1.27-alpine"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
target "console" {
|
|
|
|
name = "console-${tgt}"
|
|
|
|
inherits = ["_console"]
|
|
|
|
matrix = {
|
|
|
|
tgt = ["build", "output", "lint", "image"]
|
|
|
|
}
|
|
|
|
output = {
|
|
|
|
"build" = ["type=cacheonly"]
|
|
|
|
"output" = ["type=local,dest=.build/console"]
|
|
|
|
"lint" = ["type=cacheonly"]
|
|
|
|
"image" = ["type=docker"]
|
|
|
|
}[tgt]
|
|
|
|
tags = {
|
|
|
|
"build" = []
|
|
|
|
"output" = []
|
|
|
|
"lint" = []
|
2025-02-19 10:09:55 +01:00
|
|
|
"image" = ["${REGISTRY}/console:${GITHUB_SHA}"]
|
2025-02-19 01:02:12 +01:00
|
|
|
}[tgt]
|
2025-02-19 10:20:55 +01:00
|
|
|
cache-to = {
|
2025-02-19 10:43:58 +01:00
|
|
|
"build" = ["type=gha,ignore-error=true,mode=max,scope=console-${tgt}"]
|
|
|
|
"output" = ["type=gha,ignore-error=true,mode=max,scope=console-${tgt}"]
|
|
|
|
"lint" = ["type=gha,ignore-error=true,mode=max,scope=console-${tgt}"]
|
|
|
|
"image" = ["type=gha,ignore-error=true,mode=max,scope=console-${tgt}"]
|
2025-02-19 10:20:55 +01:00
|
|
|
}[tgt]
|
|
|
|
cache-from = {
|
2025-02-19 10:43:58 +01:00
|
|
|
"build" = ["type=gha,scope=console-${tgt}"]
|
|
|
|
"output" = ["type=gha,scope=console-${tgt}"]
|
|
|
|
"lint" = ["type=gha,scope=console-${tgt}"]
|
|
|
|
"image" = ["type=gha,scope=console-${tgt}"]
|
2025-02-19 10:20:55 +01:00
|
|
|
}[tgt]
|
2025-02-19 01:02:12 +01:00
|
|
|
target = tgt
|
|
|
|
}
|
|
|
|
|
|
|
|
target "_core" {
|
|
|
|
dockerfile = "Dockerfile.core"
|
|
|
|
context = "."
|
|
|
|
contexts = {
|
|
|
|
node = "docker-image://golang:1.23"
|
|
|
|
console = "target:console-output"
|
|
|
|
}
|
|
|
|
args = {
|
|
|
|
SASS_VERSION = "1.64.1"
|
|
|
|
GOLANG_CI_VERSION = "1.64.5"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
target "core" {
|
|
|
|
name = "core-${tgt}"
|
|
|
|
inherits = ["_core"]
|
|
|
|
matrix = {
|
2025-02-19 12:02:42 +01:00
|
|
|
tgt = ["build", "output", "lint", "image", "unit"]
|
2025-02-19 01:02:12 +01:00
|
|
|
}
|
|
|
|
output = {
|
|
|
|
"build" = ["type=cacheonly"]
|
|
|
|
"output" = ["type=local,dest=.build/core"]
|
|
|
|
"lint" = ["type=cacheonly"]
|
2025-02-19 12:02:42 +01:00
|
|
|
"unit" = ["type=cacheonly"]
|
2025-02-19 01:02:12 +01:00
|
|
|
"image" = ["type=docker"]
|
|
|
|
}[tgt]
|
|
|
|
tags = {
|
|
|
|
"build" = []
|
|
|
|
"output" = []
|
|
|
|
"lint" = []
|
2025-02-19 12:02:42 +01:00
|
|
|
"unit" = []
|
2025-02-19 10:09:55 +01:00
|
|
|
"image" = ["${REGISTRY}/zitadel:${GITHUB_SHA}"]
|
2025-02-19 10:20:55 +01:00
|
|
|
}[tgt]
|
|
|
|
cache-to = {
|
2025-02-19 10:43:58 +01:00
|
|
|
"build" = ["type=gha,ignore-error=true,mode=max,scope=core-${tgt}"]
|
|
|
|
"output" = ["type=gha,ignore-error=true,mode=max,scope=core-${tgt}"]
|
|
|
|
"lint" = ["type=gha,ignore-error=true,mode=max,scope=core-${tgt}"]
|
2025-02-19 12:02:42 +01:00
|
|
|
"unit" = ["type=gha,ignore-error=true,mode=max,scope=core-${tgt}"]
|
2025-02-19 10:43:58 +01:00
|
|
|
"image" = ["type=gha,ignore-error=true,mode=max,scope=core-${tgt}"]
|
2025-02-19 10:20:55 +01:00
|
|
|
}[tgt]
|
|
|
|
cache-from = {
|
2025-02-19 10:43:58 +01:00
|
|
|
"build" = ["type=gha,scope=core-${tgt}"]
|
|
|
|
"output" = ["type=gha,scope=core-${tgt}"]
|
|
|
|
"lint" = ["type=gha,scope=core-${tgt}"]
|
2025-02-19 12:02:42 +01:00
|
|
|
"unit" = ["type=gha,scope=core-${tgt}"]
|
2025-02-19 10:43:58 +01:00
|
|
|
"image" = ["type=gha,scope=core-${tgt}"]
|
2025-02-19 01:02:12 +01:00
|
|
|
}[tgt]
|
|
|
|
target = tgt
|
2025-02-18 17:40:41 +01:00
|
|
|
}
|