Some checks failed
ci / go (push) Has been cancelled
ci / admin-ui (push) Has been cancelled
ci / runtime-sdk (push) Has been cancelled
ci / helm (push) Has been cancelled
ci / openapi (push) Has been cancelled
ci / container (push) Has been cancelled
ci / release-config (push) Has been cancelled
ci / shared styling (push) Has been cancelled
ci / security (push) Has been cancelled
ci / all green (push) Has been cancelled
90 lines
2.3 KiB
HCL
90 lines
2.3 KiB
HCL
# Docker Bake definition.
|
|
#
|
|
# One place that knows how to build every target variant, so that `docker buildx
|
|
# bake`, the GitHub Actions workflow and a developer's terminal all produce the same
|
|
# image from the same inputs.
|
|
#
|
|
# docker buildx bake # build the default tag
|
|
# docker buildx bake --push # build and push
|
|
# docker buildx bake --print # show what would run
|
|
# docker buildx bake --set *.platform=linux/arm64
|
|
|
|
variable "VERSION" {
|
|
default = "dev"
|
|
}
|
|
|
|
variable "COMMIT" {
|
|
default = "unknown"
|
|
}
|
|
|
|
variable "BUILD_DATE" {
|
|
default = "unknown"
|
|
}
|
|
|
|
variable "REGISTRY" {
|
|
default = "ghcr.io/urpi"
|
|
}
|
|
|
|
variable "IMAGE" {
|
|
default = "${REGISTRY}/go-bananas"
|
|
}
|
|
|
|
variable "TAGS" {
|
|
default = "${IMAGE}:${VERSION}"
|
|
}
|
|
|
|
# `platforms` is a list rather than a single value so that one invocation produces
|
|
# a manifest list covering both architectures.
|
|
group "default" {
|
|
targets = ["image"]
|
|
}
|
|
|
|
target "_common" {
|
|
context = "."
|
|
dockerfile = "Dockerfile"
|
|
args = {
|
|
VERSION = VERSION
|
|
COMMIT = COMMIT
|
|
BUILD_DATE = BUILD_DATE
|
|
}
|
|
labels = {
|
|
"org.opencontainers.image.title" = "go-bananas"
|
|
"org.opencontainers.image.description" = "Runtime design-token service"
|
|
"org.opencontainers.image.version" = VERSION
|
|
"org.opencontainers.image.revision" = COMMIT
|
|
"org.opencontainers.image.created" = BUILD_DATE
|
|
"org.opencontainers.image.source" = "https://github.com/urpi/go-bananas"
|
|
}
|
|
}
|
|
|
|
target "image" {
|
|
inherits = ["_common"]
|
|
tags = ["${IMAGE}:${VERSION}", "${IMAGE}:latest"]
|
|
platforms = ["linux/amd64", "linux/arm64"]
|
|
output = ["type=image"]
|
|
}
|
|
|
|
target "image-push" {
|
|
inherits = ["_common"]
|
|
tags = split("\n", TAGS)
|
|
platforms = ["linux/amd64", "linux/arm64"]
|
|
output = ["type=image,push=true"]
|
|
}
|
|
|
|
# A local single-architecture image for `docker compose up` and for a quick look
|
|
# on a laptop, where a manifest list only adds a layer of indirection.
|
|
target "dev" {
|
|
inherits = ["_common"]
|
|
tags = ["go-bananas:dev"]
|
|
platforms = ["linux/amd64"]
|
|
output = ["type=docker"]
|
|
cache-to = ["type=gha,mode=max"]
|
|
}
|
|
|
|
# The cache-only target, for warming a CI runner before the real build.
|
|
target "cache" {
|
|
inherits = ["_common"]
|
|
platforms = ["linux/amd64"]
|
|
cache-to = ["type=gha,mode=max"]
|
|
cache-from = ["type=gha"]
|
|
}
|