-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-bake.hcl
183 lines (155 loc) · 3.11 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
// Copyright (c) Pedersen authors.
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
variable "GO_VERSION" {
# default ARG value set in Dockerfile
default = null
}
variable "OPENSSL_VERSION" {
default = null
}
variable "GO_BUILDTAGS" {
default = null
}
variable "GO_BUILDFLAGS" {
default = null
}
variable "GO_LINKMODE" {
default = null
}
variable "GO_STRIP" {
default = null
}
variable "GO_TESTFLAGS" {
default = null
}
# 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.
variable "DESTDIR" {
default = ""
}
variable "REPO_NAME" {
default = null
}
variable "REPO_URL" {
default = null
}
variable "ORGANIZATION_NAME" {
default = null
}
variable "DOCS_URL" {
default = null
}
variable "DOCS_EDIT_URL" {
default = null
}
variable "VERSION" {
default = null
}
function "outdir" {
params = [defaultdir]
result = DESTDIR != "" ? DESTDIR : "${defaultdir}"
}
target "_common" {
args = {
GO_VERSION = GO_VERSION
OPENSSL_VERSION = OPENSSL_VERSION
GO_BUILDTAGS = GO_BUILDTAGS
GO_BUILDFLAGS = GO_BUILDFLAGS
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
}
}
group "default" {
targets = ["binary"]
}
group "validate" {
targets = ["lint", "license-validate"]
}
target "lint" {
inherits = ["_common"]
target = "lint"
output = ["type=cacheonly"]
}
target "license-validate" {
target = "license-validate"
output = ["type=cacheonly"]
}
target "test" {
inherits = ["_common"]
target = "test"
args = {
GO_TESTFLAGS = GO_TESTFLAGS
}
output = ["type=cacheonly"]
platforms = ["local"]
}
target "test-cross" {
inherits = ["test"]
platforms = [
"linux/amd64",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm64",
"linux/ppc64le",
"linux/riscv64",
"linux/s390x",
]
}
target "binary" {
inherits = ["_common"]
target = "binary"
args = {
OPENSSL_VERSION = OPENSSL_VERSION
GO_LINKMODE = GO_LINKMODE
GO_STRIP = GO_STRIP
}
output = [outdir("./bin/build")]
platforms = ["local"]
}
target "binary-cross" {
inherits = ["binary"]
platforms = [
"darwin/amd64",
"darwin/arm64",
"linux/amd64",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm64",
"linux/ppc64le",
"linux/riscv64",
"linux/s390x",
"windows/amd64",
]
}
target "release" {
inherits = ["binary-cross"]
target = "release"
output = [outdir("./bin/release")]
}
target "docs" {
target = "docs-release"
args = {
ORGANIZATION_NAME = ORGANIZATION_NAME
REPO_NAME = REPO_NAME
REPO_URL = REPO_URL
DOCS_URL = DOCS_URL
DOCS_EDIT_URL = DOCS_EDIT_URL
VERSION = VERSION
}
secret = [
"type=env,id=ALGOLIA_APP_ID",
"type=env,id=ALGOLIA_SEARCH_API_KEY",
"type=env,id=ALGOLIA_INDEX_NAME",
]
output = [outdir("./bin/docs")]
}
target "docker-metadata-action" {}
target "image-cross" {
inherits = ["docker-metadata-action", "release"]
target = "image"
output = ["type=image"]
}