moby/docker-bake.hcl
CrazyMax 8086f40123
Dockerfile: use TARGETPLATFORM to build Docker
Better support for cross compilation so we can fully rely
on `--platform` flag of buildx for a seamless integration.

This removes unnecessary extra cross logic in the Dockerfile,
DOCKER_CROSSPLATFORMS and CROSS vars and some hack scripts as well.

Non-sandboxed build invocation is still supported and dev stages
in the Dockerfile have been updated accordingly.

Bake definition and GitHub Actions workflows have been updated
accordingly as well.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-01 18:03:01 +01:00

73 lines
1 KiB
HCL

variable "BUNDLES_OUTPUT" {
default = "./bundles"
}
variable "DOCKER_STATIC" {
default = "1"
}
target "_common" {
args = {
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
APT_MIRROR = "cdn-fastly.deb.debian.org"
DOCKER_STATIC = DOCKER_STATIC
}
}
group "default" {
targets = ["binary"]
}
target "_platforms" {
platforms = [
"linux/amd64",
"linux/arm/v5",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm64",
"linux/ppc64le",
"linux/s390x",
"windows/amd64"
]
}
#
# build dockerd and docker-proxy
#
target "binary" {
inherits = ["_common"]
target = "binary"
output = [BUNDLES_OUTPUT]
}
target "dynbinary" {
inherits = ["binary"]
args = {
DOCKER_STATIC = "0"
}
}
target "binary-cross" {
inherits = ["binary", "_platforms"]
}
#
# dev
#
variable "DEV_IMAGE" {
default = "docker-dev"
}
variable "SYSTEMD" {
default = "false"
}
target "dev" {
inherits = ["_common"]
target = "final"
args = {
SYSTEMD = SYSTEMD
}
tags = [DEV_IMAGE]
output = ["type=docker"]
}