github.com/xeptore/docker-cli@v20.10.14+incompatible/docker-bake.hcl (about) 1 variable "VERSION" { 2 default = "" 3 } 4 5 variable "USE_GLIBC" { 6 default = "" 7 } 8 9 variable "STRIP_TARGET" { 10 default = "" 11 } 12 13 group "default" { 14 targets = ["binary"] 15 } 16 17 target "binary" { 18 target = "binary" 19 platforms = ["local"] 20 output = ["build"] 21 args = { 22 BASE_VARIANT = USE_GLIBC != "" ? "buster" : "alpine" 23 VERSION = VERSION 24 GO_STRIP = STRIP_TARGET 25 } 26 } 27 28 target "dynbinary" { 29 inherits = ["binary"] 30 args = { 31 GO_LINKMODE = "dynamic" 32 } 33 } 34 35 variable "GROUP_TOTAL" { 36 default = "1" 37 } 38 39 variable "GROUP_INDEX" { 40 default = "0" 41 } 42 43 function "platforms" { 44 params = [] 45 result = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x", "darwin/amd64", "darwin/arm64", "windows/amd64"] 46 } 47 48 function "glen" { 49 params = [platforms, GROUP_TOTAL] 50 result = ceil(length(platforms)/GROUP_TOTAL) 51 } 52 53 target "_all_platforms" { 54 platforms = slice(platforms(), GROUP_INDEX*glen(platforms(), GROUP_TOTAL),min(length(platforms()), (GROUP_INDEX+1)*glen(platforms(), GROUP_TOTAL))) 55 } 56 57 target "cross" { 58 inherits = ["binary", "_all_platforms"] 59 } 60 61 target "dynbinary-cross" { 62 inherits = ["dynbinary", "_all_platforms"] 63 }