Build

Builds containers or applications that can be used in blueprints. The build stanza runs a docker build using the dockerfile or context defined in the container stanza. You can use this feature to build container images that can be started directly using the container resource, or copied to nomad or kubernetes.

In addition to building containers, build blocks can be used to build application code in a docker container, the product of which can be copied to the local file system using the optional output stanza.

Examples

Container Build

resource "build" "app" {
  container {
    dockerfile = "Dockerfile"
    context    = "./src"
  }
}

resource "container" "app" {
  image {
    name = resource.build.app.image
  }

  command = ["/bin/app"]

  port {
    local  = 9090
    remote = 9090
    host   = 9090
  }

  network {
    id = resource.network.onprem.meta.id
  }
}

Binary Build

resource "build" "app" {
  container {
    dockerfile = "Dockerfile"
    context    = "./src"
  }

  output {
    source = "/go/src/github.com/jumppad-labs/jumppad/bin"
    destination = "${data("local_app")}/bin"
  }
}

resource "local_exec" "app" {
  command = ["jumppad", "up", "./config"]
}

Last updated