Contributor Guide
Build Files
The image folder has the following files besides this guide and the main page:
| File | Value | Effect |
|---|---|---|
Dockerfile | Two stages | Downloads the release and copies the binary into an empty image; see Build Steps |
RESOURCE_TRACKER_VERSION | 0.1.17 | The 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_ARGS | RESOURCE_TRACKER_VERSION=${RESOURCE_TRACKER_VERSION} | CI replaces ${RESOURCE_TRACKER_VERSION} with the content of the RESOURCE_TRACKER_VERSION file |
CATEGORY | base | Image category label |
DESCRIPTION | One sentence | Image 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 planPLATFORMS: 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 itamd64orx86_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 itarm64oraarch64.WikipediaGlossaryCONTEXT: CI builds from the image folderZRAM: CI builds without compressed swapSCCACHE: CI builds without a compiler cache
The build framework of the
sc-images repository describes
the metadata files that all images share.
Build Steps
The Dockerfile builds the image in two stages:
- The
fetchstage does the following:- It starts from
alpine:3.21and installscurlandtar. - It maps the output of
uname -mto the architecture names of the releases:x86_64toamd64, andaarch64toarm64. - It downloads
resource-tracker-v<version>-linux-<arch>.tar.gzfrom theresource-tracker-rsreleases, extracts only theresource-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 mode0755. Thetar -xvzfcommand lists the extracted file in the build log.
- It starts from
- The final stage starts
FROM scratchand copies in only the binary, as/usr/local/bin/resource-tracker. It sets noENTRYPOINTorCMD.
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:
RESOURCE_TRACKER_VERSION, which 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 reads- the default of
ARG RESOURCE_TRACKER_VERSIONin theDockerfile, which a build without--build-arguses
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:
- Standalone:
benchmark,benchmark-ffmpeg,benchmark-llm,benchmark-passmark,benchmark-redis,benchmark-storage,benchmark-web,nvbandwidth - vLLM:
benchmark-vllm-cpu,benchmark-vllm-cpu-avx2,benchmark-vllm-gpu - PostgreSQLPostgreSQLAn open-source object-relational database system, developed by a global community and descended from the POSTGRES project at UC Berkeley in 1986. It uses and extends SQL, with transactions, many index types, extensions, and JSON data.PostgreSQL docsGlossary:
benchmark-pgbench-postgres,benchmark-postgres-server - stress-ng
stress-ngAn open-source tool that loads a computer in selectable ways, with hundreds of stress tests (stressors) that exercise the CPU, memory, file systems, and kernel interfaces. With--metrics, it reports each stressor's throughput in bogo ops/s.stress-ng on GitHubGlossary:stress-ng,stress-ng-longrun
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 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_TRACKERis"false", so CI uses the layer cache. - Manual run:
force_rebuild_resource_trackeris 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, 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.