2022-08-12 15:05:52 +02:00
|
|
|
// Copyright 2022 Docker Compose CLI authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
variable "GO_VERSION" {
|
2023-03-24 14:30:08 +01:00
|
|
|
# default ARG value set in Dockerfile
|
|
|
|
default = null
|
2022-08-12 15:05:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "BUILD_TAGS" {
|
2023-01-09 12:37:55 +01:00
|
|
|
default = "e2e"
|
2022-08-12 15:05:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "DOCS_FORMATS" {
|
|
|
|
default = "md,yaml"
|
|
|
|
}
|
|
|
|
|
2023-06-08 20:58:21 +02:00
|
|
|
# Defines the output folder to override the default behavior.
|
|
|
|
# See Makefile for details, this is generally only useful for
|
|
|
|
# the packaging scripts and care should be taken to not break
|
|
|
|
# them.
|
2022-08-12 15:05:52 +02:00
|
|
|
variable "DESTDIR" {
|
|
|
|
default = ""
|
|
|
|
}
|
2023-06-08 20:58:21 +02:00
|
|
|
function "outdir" {
|
2022-08-12 15:05:52 +02:00
|
|
|
params = [defaultdir]
|
2023-06-08 20:58:21 +02:00
|
|
|
result = DESTDIR != "" ? DESTDIR : "${defaultdir}"
|
2022-08-12 15:05:52 +02:00
|
|
|
}
|
|
|
|
|
2023-03-14 11:08:04 +01:00
|
|
|
# Special target: https://github.com/docker/metadata-action#bake-definition
|
|
|
|
target "meta-helper" {}
|
|
|
|
|
2022-08-12 15:05:52 +02:00
|
|
|
target "_common" {
|
|
|
|
args = {
|
|
|
|
GO_VERSION = GO_VERSION
|
|
|
|
BUILD_TAGS = BUILD_TAGS
|
|
|
|
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group "default" {
|
|
|
|
targets = ["binary"]
|
|
|
|
}
|
|
|
|
|
|
|
|
group "validate" {
|
|
|
|
targets = ["lint", "vendor-validate", "license-validate"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "lint" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
target = "lint"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "license-validate" {
|
|
|
|
target = "license-validate"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "license-update" {
|
|
|
|
target = "license-update"
|
|
|
|
output = ["."]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "vendor-validate" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
target = "vendor-validate"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
2022-12-08 18:45:47 +01:00
|
|
|
target "vendor-update" {
|
2022-08-12 15:05:52 +02:00
|
|
|
inherits = ["_common"]
|
|
|
|
target = "vendor-update"
|
|
|
|
output = ["."]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "test" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
target = "test-coverage"
|
2023-06-08 20:58:21 +02:00
|
|
|
output = [outdir("./bin/coverage/unit")]
|
2022-08-12 15:05:52 +02:00
|
|
|
}
|
|
|
|
|
2023-03-10 10:08:24 +01:00
|
|
|
target "binary-with-coverage" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
target = "binary"
|
|
|
|
args = {
|
2023-06-08 20:58:21 +02:00
|
|
|
BUILD_FLAGS = "-cover -covermode=atomic"
|
2023-03-10 10:08:24 +01:00
|
|
|
}
|
2023-06-08 20:58:21 +02:00
|
|
|
output = [outdir("./bin/build")]
|
2023-03-10 10:08:24 +01:00
|
|
|
platforms = ["local"]
|
|
|
|
}
|
|
|
|
|
2022-08-12 15:05:52 +02:00
|
|
|
target "binary" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
target = "binary"
|
2023-06-08 20:58:21 +02:00
|
|
|
output = [outdir("./bin/build")]
|
2022-08-12 15:05:52 +02:00
|
|
|
platforms = ["local"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "binary-cross" {
|
|
|
|
inherits = ["binary"]
|
|
|
|
platforms = [
|
|
|
|
"darwin/amd64",
|
|
|
|
"darwin/arm64",
|
|
|
|
"linux/amd64",
|
|
|
|
"linux/arm/v6",
|
|
|
|
"linux/arm/v7",
|
|
|
|
"linux/arm64",
|
|
|
|
"linux/ppc64le",
|
2022-08-14 23:25:50 +02:00
|
|
|
"linux/riscv64",
|
2022-08-12 15:05:52 +02:00
|
|
|
"linux/s390x",
|
2022-08-14 23:25:50 +02:00
|
|
|
"windows/amd64",
|
|
|
|
"windows/arm64"
|
2022-08-12 15:05:52 +02:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "release" {
|
|
|
|
inherits = ["binary-cross"]
|
|
|
|
target = "release"
|
2023-06-08 20:58:21 +02:00
|
|
|
output = [outdir("./bin/release")]
|
2022-08-12 15:05:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
target "docs-validate" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
target = "docs-validate"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "docs-update" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
target = "docs-update"
|
|
|
|
output = ["./docs"]
|
|
|
|
}
|
2023-03-14 11:08:04 +01:00
|
|
|
|
|
|
|
target "image-cross" {
|
|
|
|
inherits = ["meta-helper", "binary-cross"]
|
|
|
|
output = ["type=image"]
|
|
|
|
}
|