-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-bake.hcl
183 lines (159 loc) · 3.44 KB
/
docker-bake.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
variable "DOCKER_DEBUG" {
default = ""
}
variable "DOCKER_STATIC" {
default = "1"
}
variable "DOCKER_LDFLAGS" {
default = ""
}
variable "DOCKER_BUILDTAGS" {
default = ""
}
variable "DOCKER_GITCOMMIT" {
default = null
}
# Docker version such as 23.0.0-dev. Automatically generated through Git ref.
variable "VERSION" {
default = ""
}
# The platform name, such as "Docker Engine - Community".
variable "PLATFORM" {
default = ""
}
# The product name, used to set version.ProductName, which is used to set
# BuildKit's ExportedProduct variable in order to show useful error messages
# to users when a certain version of the product doesn't support a BuildKit feature.
variable "PRODUCT" {
default = ""
}
# Sets the version.DefaultProductLicense string, such as "Community Engine".
# This field can contain a summary of the product license of the daemon if a
# commercial license has been applied to the daemon.
variable "DEFAULT_PRODUCT_LICENSE" {
default = ""
}
# The name of the packager (e.g. "Docker, Inc."). This used to set CompanyName
# in the manifest.
variable "PACKAGER_NAME" {
default = ""
}
# Special target: https://github.com/docker/metadata-action#bake-definition
target "docker-metadata-action" {
tags = ["moby-bin:local"]
}
# Defines the output folder
variable "DESTDIR" {
default = ""
}
function "bindir" {
params = [defaultdir]
result = DESTDIR != "" ? DESTDIR : "./bundles/${defaultdir}"
}
target "_common" {
args = {
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
DOCKER_DEBUG = DOCKER_DEBUG
DOCKER_STATIC = DOCKER_STATIC
DOCKER_LDFLAGS = DOCKER_LDFLAGS
DOCKER_BUILDTAGS = DOCKER_BUILDTAGS
DOCKER_GITCOMMIT = DOCKER_GITCOMMIT
VERSION = VERSION
PLATFORM = PLATFORM
PRODUCT = PRODUCT
DEFAULT_PRODUCT_LICENSE = DEFAULT_PRODUCT_LICENSE
PACKAGER_NAME = PACKAGER_NAME
}
}
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 = [bindir(DOCKER_STATIC == "1" ? "binary" : "dynbinary")]
}
target "dynbinary" {
inherits = ["binary"]
output = [bindir("dynbinary")]
args = {
DOCKER_STATIC = "0"
}
}
target "binary-cross" {
inherits = ["binary", "_platforms"]
}
target "binary-smoketest" {
inherits = ["_common"]
target = "smoketest"
output = ["type=cacheonly"]
platforms = [
"linux/amd64",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm64",
"linux/ppc64le",
"linux/s390x"
]
}
#
# same as binary but with extra tools as well (containerd, runc, ...)
#
target "all" {
inherits = ["_common"]
target = "all"
output = [bindir(DOCKER_STATIC == "1" ? "binary" : "dynbinary")]
}
target "all-cross" {
inherits = ["all", "_platforms"]
}
#
# bin image
#
target "bin-image" {
inherits = ["all", "docker-metadata-action"]
output = ["type=docker"]
}
target "bin-image-cross" {
inherits = ["bin-image"]
output = ["type=image"]
platforms = [
"linux/amd64",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm64",
"linux/ppc64le",
"linux/s390x",
"windows/amd64"
]
}
#
# dev
#
variable "SYSTEMD" {
default = "false"
}
target "dev" {
inherits = ["_common"]
target = "dev"
args = {
SYSTEMD = SYSTEMD
}
tags = ["docker-dev"]
output = ["type=docker"]
}