variable "REGISTRY" {
  default = "registry.mangopig.tech"
}

variable "TAG" {
  default = "latest"
}

variable "ALLOWED_HOSTS" {
  default = ""
}

variable "STRIPE_PUBLISHABLE_KEY" {
  default = ""
}

variable "STRIPE_PRICE_ID" {
  default = ""
}

variable "API_BASE_URL" {
  default = ""
}

target "_proxy" {
  context    = "."
  dockerfile = "Proxy/Dockerfile"
  args = {
    ALLOWED_HOSTS = ALLOWED_HOSTS
    STRIPE_PUBLISHABLE_KEY = STRIPE_PUBLISHABLE_KEY
    STRIPE_PRICE_ID = STRIPE_PRICE_ID
    API_BASE_URL = API_BASE_URL
  }
}

target "prod" {
  inherits = ["_proxy"]
  target   = "runtime"
  tags     = ["goko/royal-pop/proxy:local-prod"]
}

target "prod-image" {
  inherits = ["_proxy"]
  target   = "runtime"
  tags     = ["${REGISTRY}/goko/royal-pop/proxy/prod:${TAG}"]
  output   = ["type=registry"]
}

group "local" {
  targets = ["prod"]
}

group "registry" {
  targets = ["prod-image"]
}

group "default" {
  targets = ["prod"]
}
