Skip to main content

Contributor Guide

Build Files​

The image folder has the following files besides this guide and the main page:

FileValueEffect
DockerfileTwo stagesDownloads the release and copies the binary into an empty image; see Build Steps
RESOURCE_TRACKER_VERSION0.1.17The release that CICI: Continuous IntegrationThe practice of building and testing code automatically on every change, usually on a hosted service such as GitHub Actions, so problems show up before the change is merged.WikipediaGlossary builds; see Version Changes
BUILD_ARGSRESOURCE_TRACKER_VERSION=${RESOURCE_TRACKER_VERSION}CI replaces ${RESOURCE_TRACKER_VERSION} with the content of the RESOURCE_TRACKER_VERSION file
CATEGORYbaseImage category label
DESCRIPTIONOne sentenceImage description on GHCRGHCR: GitHub Container RegistryGitHub's registry of container images, part of GitHub Packages, where images are published as ghcr.io/<owner>/<image>:<tag>. Each image gets a package page on GitHub that shows its description, a docker pull command, and the README of the repository it is linked to.GitHub docsGlossary and in the root image list

The folder has no DEPENDS_ON, PLATFORMS, CONTEXT, ZRAM, or SCCACHE file, so CI builds it with the following defaults:

  • DEPENDS_ON: CI builds it in the first level of the build plan
  • PLATFORMS: CI builds for the default platforms, AMD64AMD64The 64-bit version of the x86 instruction set architecture, introduced by AMD in 2003 and also implemented by Intel, which runs most cloud servers. Linux distributions and Docker name it amd64 or x86_64.WikipediaGlossary and Arm64Arm64The 64-bit execution state of the Arm architecture, also called AArch64, used by server CPUs such as AWS Graviton, Ampere Altra, and Google Axion. Linux distributions and Docker name it arm64 or aarch64.WikipediaGlossary
  • CONTEXT: CI builds from the image folder
  • ZRAM: CI builds without compressed swap
  • SCCACHE: CI builds without a compiler cache

The build framework of the sc-images repository⁠ (opens in a new tab) describes the metadata files that all images share.

Build Steps​

The Dockerfile⁠ (opens in a new tab) builds the image in two stages:

  1. The fetch stage does the following:
    1. It starts from alpine:3.21 and installs curl and tar.
    2. It maps the output of uname -m to the architecture names of the releases: x86_64 to amd64, and aarch64 to arm64.
    3. It downloads resource-tracker-v<version>-linux-<arch>.tar.gz from the resource-tracker-rs releases⁠ (opens in a new tab), extracts only the resource-trackerresource-trackerAn open-source Spare Cores tool that runs a command and samples resource usage while it runs, such as CPU, memory, disk, network, GPU, and GPU memory use. It can optionally stream the samples to the Spare Cores Sentinel platform, so that a run can be checked to see its aggregated and detailed resource utilization, e.g., whether it used all CPU or GPU cores as intended while running a Navigator benchmark workload.resource-tracker on GitHubGlossary file, and installs it with mode 0755. The tar -xvzf command lists the extracted file in the build log.
  2. The final stage starts FROM scratch and copies in only the binary, as /usr/local/bin/resource-tracker. It sets no ENTRYPOINT or CMD.

Any uname -m value other than x86_64 or aarch64 goes into the file name unchanged. The build fails when the release has no archive for the version or the architecture: curl -f stops at the missing file.

Version Changes​

To change the version, update both of the following by hand, to the same value:

CI strips comments (#...) and whitespace from RESOURCE_TRACKER_VERSION before it uses the value. When the file is empty or missing, CI still passes RESOURCE_TRACKER_VERSION= to the build, which overrides the Dockerfile default with an empty string, so the download fails.

The CI build tracking reads the same file to install resource-trackerresource-trackerAn open-source Spare Cores tool that runs a command and samples resource usage while it runs, such as CPU, memory, disk, network, GPU, and GPU memory use. It can optionally stream the samples to the Spare Cores Sentinel platform, so that a run can be checked to see its aggregated and detailed resource utilization, e.g., whether it used all CPU or GPU cores as intended while running a Navigator benchmark workload.resource-tracker on GitHubGlossary on the build runners, but strips only whitespace from it, so keep the file to the bare version, with no comment. See CI Build Tracking.

Local Build​

To build the image for the architecture of the current machine, with the version that the Dockerfile defaults to, run the following from the root of the sc-images repository:

docker build -t resource-tracker images/resource-tracker

To build a specific release, pass its version without the leading v:

docker build --build-arg RESOURCE_TRACKER_VERSION=<version> -t resource-tracker images/resource-tracker

CI Builds​

CICI: Continuous IntegrationThe practice of building and testing code automatically on every change, usually on a hosted service such as GitHub Actions, so problems show up before the change is merged.WikipediaGlossary builds this image natively on each architecture: AMD64 on the ubuntu-latest runner and Arm64 on the ubuntu-24.04-arm runner, or on the self-hosted runners when the self_hosted_x64 or self_hosted_arm64 option of a manual run is on. Later levels of the build plan run only when no earlier level failed, so a failed build of this image stops the build of every image that depends on it.

Consumers​

CI counts an image as a resource-trackerresource-trackerAn open-source Spare Cores tool that runs a command and samples resource usage while it runs, such as CPU, memory, disk, network, GPU, and GPU memory use. It can optionally stream the samples to the Spare Cores Sentinel platform, so that a run can be checked to see its aggregated and detailed resource utilization, e.g., whether it used all CPU or GPU cores as intended while running a Navigator benchmark workload.resource-tracker on GitHubGlossary consumer when it is this image or depends on it, directly or through other images. Consumers always build with --pull, so they pick up the newly pushed binary.

The following images depend on it directly, by listing resource-tracker in their DEPENDS_ON file, grouped by the manual that covers them:

Each of these images declares the following build argument in its Dockerfile, and copies the binary from the image it names:

ARG RESOURCE_TRACKER_IMAGE=ghcr.io/sparecores/resource-tracker:main

In CI, their BUILD_ARGS files set RESOURCE_TRACKER_IMAGE to the per-architecture ghcr.io/sparecores/resource-tracker:main-${ARCH} tag, except benchmark-ffmpeg, which keeps the main default.

Force Rebuild​

The force_rebuild_resource_tracker option of a manual run, or the FORCE_REBUILD_RESOURCE_TRACKER variable of push.yml⁠ (opens in a new tab) on a push, rebuilds this image and all consumers with --no-cache, without importing or exporting the layer cachelayer cacheThe layers of earlier container image builds that BuildKit stores and reuses. Each Dockerfile instruction adds one layer to the image, stored under a key computed from the instruction and its inputs; when a later build reaches an instruction with the same key, it reuses the stored layer instead of running the step again. A build with --no-cache ignores the cache and runs every step.Docker docsGlossary.

The defaults differ by trigger:

  • Push: FORCE_REBUILD_RESOURCE_TRACKER is "false", so CI uses the layer cache.
  • Manual run: force_rebuild_resource_tracker is on, so CI rebuilds this image and all consumers without cache. Turn it off to use the cache.

Tags​

Each architecture's build pushes its own tag of ghcr.io/sparecores/resource-tracker, main-amd64 or main-arm64. A merge job then combines the two into the multi-architecture main tag, from which docker pull takes the image of the host's architecture.

The merge job runs even when a build fails, and combines the two tags as they are in the registry at that point. A failed build leaves its tag from the previous run in place, so after a version change main can pair the new binary for one architecture with the old binary for the other. The merge job skips main and prints Skipping <tag>: missing <ref> only when a tag has never been pushed.

The merge job also makes the package public on GHCRGHCR: GitHub Container RegistryGitHub's registry of container images, part of GitHub Packages, where images are published as ghcr.io/<owner>/<image>:<tag>. Each image gets a package page on GitHub that shows its description, a docker pull command, and the README of the repository it is linked to.GitHub docsGlossary, so pulling the image needs no login.

The image labels give the title, the description from DESCRIPTION⁠ (opens in a new tab), the documentation URLURL: Uniform Resource LocatorThe address of a resource on the web or a network, such as https://sparecores.com/, made of a scheme, a host, and a path.Glossary, and the category base; the main tag carries the same values, and the source URL, as annotations. The layers are pushed compressed with zstd, at level 7. The layer cache is pushed to the same package, as the buildcache-amd64 and buildcache-arm64 tags, except in a force rebuild.