let d       = import "defaults/build_directives.ncl" in
let project = import "../provisioning/project.ncl" in

d.make_build_directives {
  workspace = project.workspace_id,

  artifacts = [
    d.make_artifact {
      image      = "%{project.image_base}:%{project.image_tag}",
      dockerfile = "Dockerfile",
      context    = ".",
      platforms  = ["linux/arm64"],
      build_args = {
        IMAGE_BASE   = project.lamina_base,
        RUST_VERSION = project.rust_version,
      },
      extra_contexts = {
        stratumiops = "../stratumiops",
      },
    },
  ],

  adapter = d.make_adapter_ref {
    kind         = 'hcloud,
    location     = "fsn1",
    ssh_key_ref  = "orchestrator-buildkit",
    network_ref  = "wuwei",
    firewall_ref = "libre-wuji-fw",
    internal_dns = "10.0.8.20",
  },

  registry = d.default_zot_registry "reg.librecloud.online" project.build_secrets.registry_push,

  cache = d.ci_cache_policy project.workspace_id,

  signing = {
    key_ref = project.build_secrets.cosign,
  },

  sccache = {
    bucket     = "sccache",
    endpoint   = "https://fsn1.your-objectstorage.com",
    credential = project.build_secrets.sccache,
  },
}
