Files
matrix-authentication-service/docker-bake.hcl
T
Quentin Gliech c2dc7c11a9 Split multi-arch Docker build into parallel jobs
- Modify Dockerfile to build single architecture based on TARGETARCH instead of cross-compiling both targets in one run
- Replace single build-image job with matrix job (amd64, arm64)
- Add finalize-image job that creates multi-arch manifests using `docker buildx imagetools create` and signs the final images
- Each architecture gets its own build cache

This enables parallel builds of each architecture, reducing total build time by running both simultaneously rather than sequentially.
2026-05-20 12:57:22 +02:00

40 lines
1.3 KiB
HCL

# Copyright 2025, 2026 Element Creations Ltd.
# Copyright 2025 New Vector Ltd.
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
# Please see LICENSE files in the repository root for full details.
#
// This is used to set the version reported by the binary through an environment
// variable. This is mainly useful when building out of a git context, like in
// CI, where we don't have the full commit history available
variable "VERGEN_GIT_DESCRIBE" {}
// This is what is baked by GitHub Actions
group "default" { targets = ["regular", "debug"] }
// Targets filled by GitHub Actions: one for the regular tag, one for the debug tag
target "docker-metadata-action" {}
target "docker-metadata-action-debug" {}
// This is extended by GitHub Actions to set the output, cache locations,
// and platforms (one architecture per job for parallel builds)
target "base" {
args = {
// This is set so that when we use a git context, the .git directory is
// present, as we may be infering the version at build time out of it
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
// Pass down the version from an external git describe source
VERGEN_GIT_DESCRIBE = "${VERGEN_GIT_DESCRIBE}"
}
}
target "regular" {
inherits = ["base", "docker-metadata-action"]
}
target "debug" {
inherits = ["base", "docker-metadata-action-debug"]
target = "debug"
}