forked from docker/actions-toolkit
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-bake.hcl
127 lines (110 loc) · 2.83 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
// Copyright 2023 actions-toolkit 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 "NODE_VERSION" {
default = null
}
group "default" {
targets = ["build"]
}
group "pre-checkin" {
targets = ["vendor", "format", "build"]
}
group "validate" {
targets = ["lint", "vendor-validate", "dockerfile-validate", "license-validate"]
}
target "_common" {
args = {
NODE_VERSION = NODE_VERSION
}
}
target "build" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "build-update"
output = ["."]
}
target "format" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "format-update"
output = ["."]
}
target "lint" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "lint"
output = ["type=cacheonly"]
}
target "vendor" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "vendor-update"
output = ["."]
}
target "vendor-validate" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "vendor-validate"
output = ["type=cacheonly"]
}
target "dockerfile-validate" {
matrix = {
dockerfile = [
"dev.Dockerfile",
"./hack/dockerfiles/license.Dockerfile"
]
}
name = "dockerfile-validate-${md5(dockerfile)}"
dockerfile = dockerfile
call = "check"
}
target "test" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "test"
output = ["type=cacheonly"]
secret = ["id=GITHUB_TOKEN,env=GITHUB_TOKEN"]
}
target "test-coverage" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "test-coverage"
output = ["./coverage"]
secret = ["id=GITHUB_TOKEN,env=GITHUB_TOKEN"]
}
# GITHUB_REF is the actual ref that triggers the workflow and used as version
# when a tag is pushed: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
variable "GITHUB_REF" {
default = ""
}
target "publish" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
args = {
GITHUB_REF = GITHUB_REF
}
target = "publish"
output = ["type=cacheonly"]
secret = ["id=NODE_AUTH_TOKEN,env=NODE_AUTH_TOKEN"]
}
target "license-validate" {
dockerfile = "./hack/dockerfiles/license.Dockerfile"
target = "validate"
output = ["type=cacheonly"]
}
target "license-update" {
dockerfile = "./hack/dockerfiles/license.Dockerfile"
target = "update"
output = ["."]
}