Skip to content

docker buildx bake and variables #2882

Answered by elangelo
elangelo asked this question in Q&A
Discussion options

You must be logged in to vote

Did some further fiddling and I found a solution.
First of all the second was not really a problem, you need to make sure the 'name' is unique (not only in your target but in your whole hcl file) so i just appended an identifier:
name = "{tgt}-prod-env"
and that worked like a charm.

Passing in the IMAGES as an array did not work. Somehow coercing an environment variable to an array never worked, so I took another approach where i pass in the IMAGES as a string and then parse them in the hcl itself:

variable "IMAGES" {
  default = "foo bar"
}
variable "TAG" {
  default = "dev"
}
target "dev-env" {
  name = "${tgt}-dev-env"
  tags = [ "${tgt}:${TAG}" ]
  context = "."
  dockerfile = "Docker…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@elangelo
Comment options

Answer selected by elangelo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant