github.com/pdmccormick/importable-docker-buildx@v0.0.0-20240426161518-e47091289030/docker-bake.hcl (about) 1 variable "GO_VERSION" { 2 default = null 3 } 4 variable "DOCS_FORMATS" { 5 default = "md" 6 } 7 variable "DESTDIR" { 8 default = "./bin" 9 } 10 variable "GOLANGCI_LINT_MULTIPLATFORM" { 11 default = null 12 } 13 14 # Special target: https://github.com/docker/metadata-action#bake-definition 15 target "meta-helper" { 16 tags = ["docker/buildx-bin:local"] 17 } 18 19 target "_common" { 20 args = { 21 GO_VERSION = GO_VERSION 22 BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 23 } 24 } 25 26 group "default" { 27 targets = ["binaries"] 28 } 29 30 group "validate" { 31 targets = ["lint", "lint-gopls", "validate-vendor", "validate-docs"] 32 } 33 34 target "lint" { 35 inherits = ["_common"] 36 dockerfile = "./hack/dockerfiles/lint.Dockerfile" 37 output = ["type=cacheonly"] 38 platforms = GOLANGCI_LINT_MULTIPLATFORM != null ? [ 39 "darwin/amd64", 40 "darwin/arm64", 41 "linux/amd64", 42 "linux/arm64", 43 "linux/s390x", 44 "linux/ppc64le", 45 "linux/riscv64", 46 "windows/amd64", 47 "windows/arm64" 48 ] : [] 49 } 50 51 target "lint-gopls" { 52 inherits = ["lint"] 53 target = "gopls-analyze" 54 } 55 56 target "validate-vendor" { 57 inherits = ["_common"] 58 dockerfile = "./hack/dockerfiles/vendor.Dockerfile" 59 target = "validate" 60 output = ["type=cacheonly"] 61 } 62 63 target "validate-docs" { 64 inherits = ["_common"] 65 args = { 66 FORMATS = DOCS_FORMATS 67 BUILDX_EXPERIMENTAL = 1 // enables experimental cmds/flags for docs generation 68 } 69 dockerfile = "./hack/dockerfiles/docs.Dockerfile" 70 target = "validate" 71 output = ["type=cacheonly"] 72 } 73 74 target "validate-authors" { 75 inherits = ["_common"] 76 dockerfile = "./hack/dockerfiles/authors.Dockerfile" 77 target = "validate" 78 output = ["type=cacheonly"] 79 } 80 81 target "validate-generated-files" { 82 inherits = ["_common"] 83 dockerfile = "./hack/dockerfiles/generated-files.Dockerfile" 84 target = "validate" 85 output = ["type=cacheonly"] 86 } 87 88 target "update-vendor" { 89 inherits = ["_common"] 90 dockerfile = "./hack/dockerfiles/vendor.Dockerfile" 91 target = "update" 92 output = ["."] 93 } 94 95 target "update-docs" { 96 inherits = ["_common"] 97 args = { 98 FORMATS = DOCS_FORMATS 99 BUILDX_EXPERIMENTAL = 1 // enables experimental cmds/flags for docs generation 100 } 101 dockerfile = "./hack/dockerfiles/docs.Dockerfile" 102 target = "update" 103 output = ["./docs/reference"] 104 } 105 106 target "update-authors" { 107 inherits = ["_common"] 108 dockerfile = "./hack/dockerfiles/authors.Dockerfile" 109 target = "update" 110 output = ["."] 111 } 112 113 target "update-generated-files" { 114 inherits = ["_common"] 115 dockerfile = "./hack/dockerfiles/generated-files.Dockerfile" 116 target = "update" 117 output = ["."] 118 } 119 120 target "mod-outdated" { 121 inherits = ["_common"] 122 dockerfile = "./hack/dockerfiles/vendor.Dockerfile" 123 target = "outdated" 124 no-cache-filter = ["outdated"] 125 output = ["type=cacheonly"] 126 } 127 128 target "test" { 129 inherits = ["_common"] 130 target = "test-coverage" 131 output = ["${DESTDIR}/coverage"] 132 } 133 134 target "binaries" { 135 inherits = ["_common"] 136 target = "binaries" 137 output = ["${DESTDIR}/build"] 138 platforms = ["local"] 139 } 140 141 target "binaries-cross" { 142 inherits = ["binaries"] 143 platforms = [ 144 "darwin/amd64", 145 "darwin/arm64", 146 "linux/amd64", 147 "linux/arm/v6", 148 "linux/arm/v7", 149 "linux/arm64", 150 "linux/ppc64le", 151 "linux/riscv64", 152 "linux/s390x", 153 "windows/amd64", 154 "windows/arm64" 155 ] 156 } 157 158 target "release" { 159 inherits = ["binaries-cross"] 160 target = "release" 161 output = ["${DESTDIR}/release"] 162 } 163 164 target "image" { 165 inherits = ["meta-helper", "binaries"] 166 output = ["type=image"] 167 } 168 169 target "image-cross" { 170 inherits = ["meta-helper", "binaries-cross"] 171 output = ["type=image"] 172 } 173 174 target "image-local" { 175 inherits = ["image"] 176 output = ["type=docker"] 177 } 178 179 variable "HTTP_PROXY" { 180 default = "" 181 } 182 variable "HTTPS_PROXY" { 183 default = "" 184 } 185 variable "NO_PROXY" { 186 default = "" 187 } 188 variable "TEST_BUILDKIT_TAG" { 189 default = null 190 } 191 192 target "integration-test-base" { 193 inherits = ["_common"] 194 args = { 195 HTTP_PROXY = HTTP_PROXY 196 HTTPS_PROXY = HTTPS_PROXY 197 NO_PROXY = NO_PROXY 198 BUILDKIT_VERSION = TEST_BUILDKIT_TAG 199 } 200 target = "integration-test-base" 201 output = ["type=cacheonly"] 202 } 203 204 target "integration-test" { 205 inherits = ["integration-test-base"] 206 target = "integration-test" 207 }