docker-bake.hcl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // Copyright 2022 Docker Compose CLI authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. variable "GO_VERSION" {
  15. default = "1.18.5"
  16. }
  17. variable "BUILD_TAGS" {
  18. default = "e2e,kube"
  19. }
  20. variable "DOCS_FORMATS" {
  21. default = "md,yaml"
  22. }
  23. # Defines the output folder
  24. variable "DESTDIR" {
  25. default = ""
  26. }
  27. function "bindir" {
  28. params = [defaultdir]
  29. result = DESTDIR != "" ? DESTDIR : "./bin/${defaultdir}"
  30. }
  31. target "_common" {
  32. args = {
  33. GO_VERSION = GO_VERSION
  34. BUILD_TAGS = BUILD_TAGS
  35. BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
  36. }
  37. }
  38. group "default" {
  39. targets = ["binary"]
  40. }
  41. group "validate" {
  42. targets = ["lint", "vendor-validate", "license-validate"]
  43. }
  44. target "lint" {
  45. inherits = ["_common"]
  46. target = "lint"
  47. output = ["type=cacheonly"]
  48. }
  49. target "license-validate" {
  50. target = "license-validate"
  51. output = ["type=cacheonly"]
  52. }
  53. target "license-update" {
  54. target = "license-update"
  55. output = ["."]
  56. }
  57. target "vendor-validate" {
  58. inherits = ["_common"]
  59. target = "vendor-validate"
  60. output = ["type=cacheonly"]
  61. }
  62. target "vendor" {
  63. inherits = ["_common"]
  64. target = "vendor-update"
  65. output = ["."]
  66. }
  67. target "test" {
  68. inherits = ["_common"]
  69. target = "test-coverage"
  70. output = [bindir("coverage")]
  71. }
  72. target "binary" {
  73. inherits = ["_common"]
  74. target = "binary"
  75. output = [bindir("build")]
  76. platforms = ["local"]
  77. }
  78. target "binary-cross" {
  79. inherits = ["binary"]
  80. platforms = [
  81. "darwin/amd64",
  82. "darwin/arm64",
  83. "linux/amd64",
  84. "linux/arm/v6",
  85. "linux/arm/v7",
  86. "linux/arm64",
  87. "linux/ppc64le",
  88. "linux/riscv64",
  89. "linux/s390x",
  90. "windows/amd64",
  91. "windows/arm64"
  92. ]
  93. }
  94. target "release" {
  95. inherits = ["binary-cross"]
  96. target = "release"
  97. output = [bindir("release")]
  98. }
  99. target "docs-validate" {
  100. inherits = ["_common"]
  101. target = "docs-validate"
  102. output = ["type=cacheonly"]
  103. }
  104. target "docs-update" {
  105. inherits = ["_common"]
  106. target = "docs-update"
  107. output = ["./docs"]
  108. }