...
1variable "GO_VERSION" {
2 default = "1.21.8"
3}
4variable "VERSION" {
5 default = ""
6}
7variable "USE_GLIBC" {
8 default = ""
9}
10variable "STRIP_TARGET" {
11 default = ""
12}
13variable "IMAGE_NAME" {
14 default = "docker-cli"
15}
16
17# Sets the name of the company that produced the windows binary.
18variable "PACKAGER_NAME" {
19 default = ""
20}
21
22target "_common" {
23 args = {
24 GO_VERSION = GO_VERSION
25 BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
26 }
27}
28
29target "_platforms" {
30 platforms = [
31 "darwin/amd64",
32 "darwin/arm64",
33 "linux/amd64",
34 "linux/arm/v6",
35 "linux/arm/v7",
36 "linux/arm64",
37 "linux/ppc64le",
38 "linux/riscv64",
39 "linux/s390x",
40 "windows/amd64",
41 "windows/arm64"
42 ]
43}
44
45group "default" {
46 targets = ["binary"]
47}
48
49target "binary" {
50 inherits = ["_common"]
51 target = "binary"
52 platforms = ["local"]
53 output = ["build"]
54 args = {
55 BASE_VARIANT = USE_GLIBC == "1" ? "debian" : "alpine"
56 VERSION = VERSION
57 PACKAGER_NAME = PACKAGER_NAME
58 GO_STRIP = STRIP_TARGET
59 }
60}
61
62target "dynbinary" {
63 inherits = ["binary"]
64 args = {
65 GO_LINKMODE = "dynamic"
66 }
67}
68
69target "plugins" {
70 inherits = ["_common"]
71 target = "plugins"
72 platforms = ["local"]
73 output = ["build"]
74 args = {
75 BASE_VARIANT = USE_GLIBC == "1" ? "debian" : "alpine"
76 VERSION = VERSION
77 GO_STRIP = STRIP_TARGET
78 }
79}
80
81target "cross" {
82 inherits = ["binary", "_platforms"]
83}
84
85target "dynbinary-cross" {
86 inherits = ["dynbinary", "_platforms"]
87}
88
89target "plugins-cross" {
90 inherits = ["plugins", "_platforms"]
91}
92
93target "lint" {
94 inherits = ["_common"]
95 dockerfile = "./dockerfiles/Dockerfile.lint"
96 target = "lint"
97 output = ["type=cacheonly"]
98}
99
100target "shellcheck" {
101 inherits = ["_common"]
102 dockerfile = "./dockerfiles/Dockerfile.shellcheck"
103 target = "shellcheck"
104 output = ["type=cacheonly"]
105}
106
107target "validate-vendor" {
108 inherits = ["_common"]
109 dockerfile = "./dockerfiles/Dockerfile.vendor"
110 target = "validate"
111 output = ["type=cacheonly"]
112}
113
114target "update-vendor" {
115 inherits = ["_common"]
116 dockerfile = "./dockerfiles/Dockerfile.vendor"
117 target = "update"
118 output = ["."]
119}
120
121target "mod-outdated" {
122 inherits = ["_common"]
123 dockerfile = "./dockerfiles/Dockerfile.vendor"
124 target = "outdated"
125 no-cache-filter = ["outdated"]
126 output = ["type=cacheonly"]
127}
128
129target "validate-authors" {
130 inherits = ["_common"]
131 dockerfile = "./dockerfiles/Dockerfile.authors"
132 target = "validate"
133 output = ["type=cacheonly"]
134}
135
136target "update-authors" {
137 inherits = ["_common"]
138 dockerfile = "./dockerfiles/Dockerfile.authors"
139 target = "update"
140 output = ["."]
141}
142
143target "test" {
144 target = "test"
145 output = ["type=cacheonly"]
146}
147
148target "test-coverage" {
149 target = "test-coverage"
150 output = ["build/coverage"]
151}
152
153target "e2e-image" {
154 target = "e2e"
155 output = ["type=docker"]
156 tags = ["${IMAGE_NAME}"]
157 args = {
158 BASE_VARIANT = USE_GLIBC == "1" ? "debian" : "alpine"
159 VERSION = VERSION
160 }
161}
162
163target "e2e-gencerts" {
164 inherits = ["_common"]
165 dockerfile = "./e2e/testdata/Dockerfile.gencerts"
166 output = ["./e2e/testdata"]
167}
168
169target "docker-metadata-action" {
170 tags = ["cli-bin:local"]
171}
172
173target "bin-image" {
174 inherits = ["binary", "docker-metadata-action"]
175 target = "bin-image"
176 output = ["type=docker"]
177}
178
179target "bin-image-cross" {
180 inherits = ["bin-image"]
181 output = ["type=image"]
182 platforms = [
183 "linux/amd64",
184 "linux/arm/v6",
185 "linux/arm/v7",
186 "linux/arm64",
187 "linux/ppc64le",
188 "linux/s390x",
189 "windows/amd64",
190 "windows/arm64"
191 ]
192}
View as plain text