> This page is for Remediation Orchestrator.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/remediation-orchestrator/llms.txt.

# Build and publish images

> Build, load, and publish NVIDIA Remediation Orchestrator container images from source.

Build the NVIDIA Remediation Orchestrator (NRO) container image from source. Then load
it into Docker or push it to a registry. NRO supplies no published image, so each
deployment needs an image that you build or one that you already have.

This guide applies to any deployment method. Sections that apply only to Helm say so.
To package the image with both Helm charts in one OCI bundle, follow
[Build and consume artifacts](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/helm/docs/operations/artifacts.md).

## Before you begin

You need:

- **An application source checkout.** Use the
  [Remediation Orchestrator source](https://github.com/dsx-ai-factory/remediation-orchestrator)
  or a module that depends on `nv_maestro`. The Helm module alone has no image target.
- **Bazel at the version in the checkout's `.bazelversion`.** Bazelisk selects that
  version for you. The Helm module's tool versions apply to Helm tooling only.
- **A Linux C/C++ toolchain.** The build uses cgo
  ([Toolchain and architecture](#toolchain-and-architecture)).
- **A running Docker daemon** to load the image locally.
- **Push access to a registry** to publish the image.

`maestro` is NRO's historical runtime name. It remains in the application binary, Bazel
target names, and the locally loaded image tag. All of these refer to NRO.

## Build the NRO image

Skip the build if you already have a compatible image. For Helm deployments on a shared
cluster, put its repository and tag or digest in your state file
([Write your state file](/remediation-orchestrator/deployment/helm/quick-start/shared-k8s#4-write-your-state-file)).
For the local Helm quick start, make it available in Docker as `maestro:latest`, for
example with `docker pull` and `docker tag`.

A compatible image contains `/bin/maestro` and the UI assets. For Helm deployments, it
must also contain a `/bin/database-ready` probe that accepts the retry flags the
bootstrap chart passes. Without that probe, the bootstrap `wait-postgres` init container
fails. This includes a bare NRO binary and an image built before those flags existed.

Run the build from the application source root, the directory that contains
`cmd/maestro/`. From a module that depends on the application module, use the
`@nv_maestro` labels instead:

| Source checkout | Local Docker load target | Registry push target |
| --- | --- | --- |
| Remediation Orchestrator source root, with `cmd/maestro/` | `//cmd/maestro:maestro.image.local_load` | `//cmd/maestro:maestro.image.push` |
| A module that depends on `nv_maestro` | `@nv_maestro//cmd/maestro:maestro.image.local_load` | `@nv_maestro//cmd/maestro:maestro.image.push` |

If you are following a Helm quick start, run this block while you are still in the Helm
module root. It records that directory so that you can return to it
([Where to keep your state file](/remediation-orchestrator/deployment/helm/configuration/environments#where-to-keep-your-state-file)).
Skip it if you do not deploy with Helm:

```sh
# Record the Helm module root while you are in it.
nro_helm_dir="$PWD"
```

Change to the application source root. Then build the image and load it into Docker:

```sh
# Build the image and load it into Docker as maestro:latest.
bazel run //cmd/maestro:maestro.image.local_load
# Print the loaded image's content-addressed ID.
docker image inspect --format '{{.Id}}' maestro:latest
```

Bazel builds the backend and frontend, assembles the image, and loads it into Docker as
`maestro:latest`. The image includes `/bin/maestro` and the standalone
`/bin/database-ready` probe that bootstrap uses. Both binaries use the application's
pinned pgx dependency. Rebuild this image when you change the probe. PostgreSQL
readiness needs no separate image.

The first build can take several minutes. What comes next depends on how you deploy:

- **Local Helm quick start:** return to the Helm module root, for example with
  `cd "$nro_helm_dir"`. Then continue with
  [Create the cluster and install](/remediation-orchestrator/deployment/helm/quick-start/local-k8s#create-the-cluster-and-install).
- **Existing local Helm deployment:** after a code change, follow
  [Rebuild and redeploy](/remediation-orchestrator/deployment/helm/operations/maintenance#rebuild-and-redeploy).

## Build and publish your image

A shared cluster pulls the image from a registry. You need permission to push to the
repository, and the cluster must be able to pull from it. For Helm deployments with a
private registry, configure pull credentials in
[Create the namespace and Secrets](/remediation-orchestrator/deployment/helm/quick-start/shared-k8s#3-create-the-namespace-and-secrets).

The push target builds Linux amd64 and arm64 images, so it needs the
[image-build toolchain](#toolchain-and-architecture) for both. In the example below,
replace `registry.example.invalid` with your registry host in both commands,
`team/remediation-orchestrator` with your repository path, and `1.0.0` with a new
release tag. From the application source root, sign in to your registry and push:

```sh
# Sign in to your registry.
docker login registry.example.invalid
# Build and push Linux amd64 and arm64 images.
bazel run //cmd/maestro:maestro.image.push -- \
  --repository registry.example.invalid/team/remediation-orchestrator \
  --tag 1.0.0
```

Always supply your registry repository and a new explicit release tag with `--tag`. Do
not reuse a release tag for different image content. Unless your registry enforces tag
immutability, a later push can overwrite any tag. For production deployments, deploy
the pushed image index by digest.

The target pushes `--tag` together with two generated tags, `0.0.0` and `commit`. Every
unstamped push overwrites those two tags, so do not deploy them. A registry that forbids
tag overwrites rejects the generated tags on a later push. The push applies your
explicit tag first, so a failed push can still leave that tag published. Check the
registry before you retry.

With `--config=stamp`, the generated tags become the Git version identifier and the
commit SHA. `tools/workspace_status.sh` reports both. The version identifier follows
these rules:

- It starts with the nearest tag that matches `v[0-9]*`, annotated or lightweight.
- When the commit comes after that tag, `-<commit count>-g<abbreviated hash>` follows
  it, as in `v1.2.0-3-gabc1234`.
- With no matching tag, it is the abbreviated hash alone.
- A `.dirty` suffix marks uncommitted changes to tracked files.

The push target accepts the runtime flags of the pinned
[rules_oci push implementation](https://github.com/bazel-contrib/rules_oci/blob/v2.2.7/oci/private/push.sh.tpl).

To deploy the image with Helm, change to the Helm module root. Then set the repository
and your explicit tag in your state file
([Write your state file](/remediation-orchestrator/deployment/helm/quick-start/shared-k8s#4-write-your-state-file)).
For a digest, set `tag: ""` and `digest: sha256:<64 hex>`.

## Toolchain and architecture

The image build enables cgo, so it needs a C/C++ toolchain for each target Linux
architecture:

| Target | Linux architectures built |
| --- | --- |
| Local Docker load | The host's architecture: `linux/arm64` on an ARM64 host, `linux/amd64` on an x86-64 host, including macOS hosts |
| Registry push | Both `linux/amd64` and `linux/arm64` |

The application source module registers hermetic Zig cross-compilers for both Linux
architectures. Use the checkout's toolchain configuration. Do not assume that your host
compiler targets Linux. Helm render tests do not check image builds or host-platform
compatibility.

The `go_binary(name = "maestro", oci = True, ...)` macro in `cmd/maestro/BUILD.bazel`
generates the image targets, so they do not appear there by name. The binary-only
target, `//cmd/maestro:maestro`, does not package a deployable image.

## Bootstrap runtime

This section applies to Helm deployments. The Temporal bootstrap Job runs a POSIX `sh`
script in the public admin-tools image. The chart inlines the script, so you do not
build or load a separate image for it.

By default, Helmfile uses the locked admin-tools image from the same Temporal release as
the server. To select a mirror or a compatible override, set
`upstreamImages.temporalAdminTools`. The selected image must meet the bootstrap chart's
[image contract](/remediation-orchestrator/deployment/helm/reference/bootstrap-chart#images).

PostgreSQL readiness uses `/bin/database-ready` in the NRO application image. Rebuild
that image to include the retry flags that the bootstrap chart requires.

## Next steps

- For the local Helm quick start, install a locally loaded image:
  [Create the cluster and install](/remediation-orchestrator/deployment/helm/quick-start/local-k8s#create-the-cluster-and-install).
- For a shared Helm deployment, select the pushed image:
  [Write your state file](/remediation-orchestrator/deployment/helm/quick-start/shared-k8s#4-write-your-state-file).
- For an existing Helm deployment, roll out a new image:
  [Upgrade](/remediation-orchestrator/deployment/helm/operations/maintenance#upgrade).
- For image-build failures, check the Helm troubleshooting guide:
  [Preparation and rendering](/remediation-orchestrator/deployment/helm/operations/troubleshooting#preparation-and-rendering).
- For Helm deployments, bundle the image with both charts in one OCI bundle:
  [Build and consume artifacts](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/helm/docs/operations/artifacts.md).