chore: fix login image with sha release (#10157)

# Which Problems Are Solved

Fixes the releasing of multi-architecture login images.

# How the Problems Are Solved

- The login-container workflow extends the bake definition with a file
docker-bake-release.hcl wich adds the platforms linux/arm and linux/amd
to all relevant build targets. The used technique is similar to how the
docker metadata action allows to extend the bake definitions.
- The local login tag is moved to the metadata bake target, which is
always inherited and overwritten in the pipeline
- Packages write permission is added

# Additional Changes

- The MIT license is noted in container labels and annotations
- The Image is built from root so that the local proto files are used

---------

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Elio Bischof
2025-07-03 13:10:10 +02:00
committed by GitHub
co-authored by Copilot
parent 47f0486ee8
commit 12656235e2
6 changed files with 40 additions and 16 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ export GID := $(id -g)
export LOGIN_TEST_ACCEPTANCE_BUILD_CONTEXT := $(LOGIN_DIR)apps/login-test-acceptance
export DOCKER_METADATA_OUTPUT_VERSION ?= local
export LOGIN_TAG ?= login:${DOCKER_METADATA_OUTPUT_VERSION}
export LOGIN_TAG ?= zitadel-login:${DOCKER_METADATA_OUTPUT_VERSION}
export LOGIN_TEST_UNIT_TAG := login-test-unit:${DOCKER_METADATA_OUTPUT_VERSION}
export LOGIN_TEST_INTEGRATION_TAG := login-test-integration:${DOCKER_METADATA_OUTPUT_VERSION}
export LOGIN_TEST_ACCEPTANCE_TAG := login-test-acceptance:${DOCKER_METADATA_OUTPUT_VERSION}
@@ -16,7 +16,7 @@ services:
ZITADEL_ADMIN_USER: [email protected]
login:
image: "${LOGIN_TAG:-login:local}"
image: "${LOGIN_TAG:-zitadel-login:local}"
container_name: acceptance-login
labels:
- "traefik.enable=true"
+3
View File
@@ -0,0 +1,3 @@
target "release" {
platforms = ["linux/amd64", "linux/arm64"]
}
+22 -8
View File
@@ -6,12 +6,18 @@ variable "DOCKERFILES_DIR" {
default = "dockerfiles/"
}
# The release target is overwritten in docker-bake-release.hcl
# It makes sure the image is built for multiple platforms.
# By default the platforms property is empty, so images are only built for the current bake runtime platform.
target "release" {}
# typescript-proto-client is used to generate the client code for the login service.
# It is not login-prefixed, so it is easily extendable.
# To extend this bake-file.hcl, set the context of all login-prefixed targets to a different directory.
# For example docker bake --file login/docker-bake.hcl --file docker-bake.hcl --set login-*.context=./login/
# The zitadel repository uses this to generate the client and the mock server from local proto files.
target "typescript-proto-client" {
inherits = ["release"]
dockerfile = "${DOCKERFILES_DIR}typescript-proto-client.Dockerfile"
contexts = {
# We directly generate and download the client server-side with buf, so we don't need the proto files
@@ -37,6 +43,7 @@ target "login-typescript-proto-client-out" {
# For example docker bake --file login/docker-bake.hcl --file docker-bake.hcl --set login-*.context=./login/
# The zitadel repository uses this to generate the client and the mock server from local proto files.
target "proto-files" {
inherits = ["release"]
dockerfile = "${DOCKERFILES_DIR}proto-files.Dockerfile"
contexts = {
login-pnpm = "target:login-pnpm"
@@ -48,6 +55,7 @@ variable "NODE_VERSION" {
}
target "login-pnpm" {
inherits = ["release"]
dockerfile = "${DOCKERFILES_DIR}login-pnpm.Dockerfile"
args = {
NODE_VERSION = "${NODE_VERSION}"
@@ -76,6 +84,7 @@ target "login-test-unit" {
}
target "login-client" {
inherits = ["release"]
dockerfile = "${DOCKERFILES_DIR}login-client.Dockerfile"
contexts = {
login-pnpm = "target:login-pnpm"
@@ -93,7 +102,7 @@ target "core-mock" {
contexts = {
protos = "target:proto-files"
}
tags = ["${LOGIN_CORE_MOCK_TAG}"]
tags = ["${LOGIN_CORE_MOCK_TAG}"]
}
variable "LOGIN_TEST_INTEGRATION_TAG" {
@@ -105,7 +114,7 @@ target "login-test-integration" {
contexts = {
login-pnpm = "target:login-pnpm"
}
tags = ["${LOGIN_TEST_INTEGRATION_TAG}"]
tags = ["${LOGIN_TEST_INTEGRATION_TAG}"]
}
variable "LOGIN_TEST_ACCEPTANCE_TAG" {
@@ -117,28 +126,33 @@ target "login-test-acceptance" {
contexts = {
login-pnpm = "target:login-pnpm"
}
tags = ["${LOGIN_TEST_ACCEPTANCE_TAG}"]
tags = ["${LOGIN_TEST_ACCEPTANCE_TAG}"]
}
variable "LOGIN_TAG" {
default = "zitadel-login:local"
}
target "docker-metadata-action" {}
target "docker-metadata-action" {
# In the pipeline, this target is overwritten by the docker metadata action.
tags = ["${LOGIN_TAG}"]
}
# We run integration and acceptance tests against the next standalone server for docker.
target "login-standalone" {
inherits = ["docker-metadata-action"]
inherits = [
"docker-metadata-action",
"release",
]
dockerfile = "${DOCKERFILES_DIR}login-standalone.Dockerfile"
contexts = {
login-client = "target:login-client"
}
tags = ["${LOGIN_TAG}"]
}
target "login-standalone-out" {
inherits = ["login-standalone"]
target = "login-standalone-out"
inherits = ["login-standalone"]
target = "login-standalone-out"
output = [
"type=local,dest=${LOGIN_DIR}apps/login/standalone"
]