Skip to content

You are viewing documentation for Instruqt 2.0 Labs - our upcoming product releasing in September 2026. For current Tracks documentation, please visitdocs.instruqt.com.

Build


Defined insandbox.hcl

The build resource builds a container image from a Dockerfile during provisioning and, optionally, pushes it to one or more registries. Other resources can then reference the built image, letting a lab ship custom images without a separate CI pipeline.

resource "build" "app" {
container {
context = "./src"
dockerfile = "./Dockerfile"
}
}
resource "build" "app" {
container {
context = "./src"
dockerfile = "./Dockerfile"
args = {
VERSION = "1.0.0"
}
ignore = ["node_modules", ".git"]
}
registry {
name = "registry.example.com/app:latest"
}
}

Fields

FieldTypeRequiredDescription
containerblockContainer build configuration
outputblockFiles or directories to copy from the containerrepeatable
registryblockRegistry to push the built image torepeatable

Container

buildContainer

Container build configuration

FieldTypeRequiredDescription
dockerfilestringLocation of Dockerfile inside build context, defaults to ./Dockerfile
contextstringPath to build context
ignorelist(string)Files to ignore in the build context, same as .dockerignore
argsmap(string)Build args to pass to the container

Output

buildOutput

Files or directories to copy from the container

FieldTypeRequiredDescription
sourcestringSource file or directory in the container
destinationstringDestination for copied file or directory

Registry

buildRegistry

Registry to push the built image to

FieldTypeRequiredDescription
namestringFull image name including registry and tag
usernamestringRegistry username for authentication
passwordstringRegistry password for authentication

Computed Attributes

These attributes are set by the system and are read-only.

AttributeTypeDescription
imagestringFull local reference of the built image
build_checksumstringChecksum calculated from the build context files
resource "build" "app" {
container {
context = "./app"
}
}
resource "container" "app" {
image {
name = resource.build.app.image
}
}
  1. Small contexts: Keep the build context minimal and use ignore to exclude files that don’t belong in the image.
  2. Explicit tags: Give pushed images explicit tags in registry.name rather than relying on latest.