Skip to content

Commit 00a88b8

Browse files
committed
refactor: generalize container build tooling for Docker and Podman compatibility
Rename Docker-branded env vars, scripts, and mise tasks to generic container terminology while preserving full backwards compatibility. - Add ce_resolve_containerfile() helper to container-engine.sh that auto-detects Containerfile.X or Dockerfile.X (Containerfile preferred) - Rename build scripts from docker-* to container-* (4 files) - Add CONTAINER_* env var equivalents with DOCKER_* fallbacks (9 vars) - Create tasks/container.toml with canonical build:container:* task names - Convert tasks/docker.toml to pure alias file for backwards compat - Update all cross-references in shell scripts, TOML task files, CI workflow, architecture docs, and agent files - Fix pre-existing bug: remove exec keyword from container-build-ci.sh (exec does not work with bash functions) Closes NVIDIA#968 Signed-off-by: Adam Miller <[email protected]>
1 parent dfd4768 commit 00a88b8

15 files changed

Lines changed: 347 additions & 253 deletions

‎.github/workflows/docker-build.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ jobs:
233233
DOCKER_BUILDER: openshell
234234
run: |
235235
set -euo pipefail
236-
mise exec -- tasks/scripts/docker-build-image.sh "${{ inputs.component }}" \
236+
mise exec -- tasks/scripts/container-build-image.sh "${{ inputs.component }}" \
237237
--cache-from "type=gha,scope=${{ inputs.component }}-${{ matrix.arch }}" \
238238
--cache-to "type=gha,mode=max,scope=${{ inputs.component }}-${{ matrix.arch }}"
239239

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ ocsf_emit!(event);
178178

179179
- Always use `uv` for Python commands (e.g., `uv pip install`, `uv run`, `uv venv`)
180180

181-
## Docker
181+
## Containers
182182

183-
- Always prefer `mise` commands over direct docker builds (e.g., `mise run docker:build` instead of `docker build`)
183+
- Always prefer `mise` commands over direct container builds (e.g., `mise run build:container` instead of `docker build` or `podman build`)
184184

185185
## Cluster Infrastructure Changes
186186

‎e2e/with-docker-gateway.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ else
368368
CONTAINER_ENGINE=docker \
369369
DOCKER_PLATFORM="linux/${DAEMON_ARCH}" \
370370
DOCKER_OUTPUT="type=local,dest=${SUPERVISOR_OUT_DIR}" \
371-
bash "${ROOT}/tasks/scripts/docker-build-image.sh" supervisor-output
371+
bash "${ROOT}/tasks/scripts/container-build-image.sh" supervisor-output
372372
fi
373373

374374
if [ ! -f "${SUPERVISOR_BIN}" ]; then
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
# SPDX-License-Identifier: Apache-2.0
55

6-
# Clean up stale Docker images, volumes, and build cache that are not in use
6+
# Clean up stale container images, volumes, and build cache that are not in use
77
# by the currently deployed OpenShell cluster.
88
#
99
# Preserves:
@@ -13,7 +13,7 @@
1313
# - Volumes attached to running containers
1414
#
1515
# Usage:
16-
# ./scripts/docker-cleanup.sh [options]
16+
# ./scripts/container-cleanup.sh [options]
1717
#
1818
# Options:
1919
# --dry-run Show what would be removed without deleting anything

‎tasks/ci.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[build]
77
description = "Build the whole project"
8-
depends = ["build:rust:workspace", "build:docker", "build:python:wheel"]
8+
depends = ["build:rust:workspace", "build:container", "build:python:wheel"]
99

1010
["build:rust"]
1111
description = "Alias for build:rust:workspace"

‎tasks/container.toml‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Container image build tasks (engine-neutral: Docker or Podman)
5+
6+
["build:container"]
7+
description = "Build all container images"
8+
depends = [
9+
"build:container:gateway",
10+
"build:container:supervisor",
11+
]
12+
hide = true
13+
14+
["build:container:ci"]
15+
description = "Build the CI container image"
16+
run = "tasks/scripts/container-build-ci.sh"
17+
hide = true
18+
19+
["build:container:gateway"]
20+
description = "Build the gateway container image"
21+
run = "tasks/scripts/container-build-image.sh gateway"
22+
hide = true
23+
24+
["build:container:supervisor"]
25+
description = "Build the standalone supervisor container image (Ubuntu-based, for K8s pods)"
26+
run = "tasks/scripts/container-build-image.sh supervisor"
27+
hide = true
28+
29+
["build:container:multiarch"]
30+
description = "Build multi-arch gateway and supervisor images and push to a registry"
31+
run = "tasks/scripts/container-publish-multiarch.sh"
32+
hide = true
33+
34+
["container:cleanup"]
35+
description = "Remove stale images, volumes, and build cache not used by the current deployments"
36+
run = "scripts/container-cleanup.sh --force"
37+
38+
["container:cleanup:dry-run"]
39+
description = "Preview what container:cleanup would remove without deleting anything"
40+
run = "scripts/container-cleanup.sh --dry-run"

‎tasks/docker.toml‎

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Docker image build tasks
4+
# Backwards-compatible aliases: build:docker:* → build:container:*
5+
# These exist so CI workflows and muscle memory keep working.
56

67
["build:docker"]
7-
description = "Build all Docker images"
8-
depends = [
9-
"build:docker:gateway",
10-
"build:docker:supervisor",
11-
]
8+
description = "Alias → build:container (all container images)"
9+
depends = ["build:container"]
1210
hide = true
1311

1412
["build:docker:ci"]
15-
description = "Build the CI Docker image"
16-
run = "tasks/scripts/docker-build-ci.sh"
13+
description = "Alias → build:container:ci"
14+
depends = ["build:container:ci"]
1715
hide = true
1816

1917
["build:docker:prebuilt"]
@@ -22,39 +20,39 @@ run = "tasks/scripts/stage-prebuilt-binaries.sh all"
2220
hide = true
2321

2422
["build:docker:gateway"]
25-
description = "Build the gateway Docker image"
26-
run = "tasks/scripts/docker-build-image.sh gateway"
23+
description = "Alias → build:container:gateway"
24+
depends = ["build:container:gateway"]
2725
hide = true
2826

2927
["build:docker:supervisor"]
30-
description = "Build the supervisor image"
31-
run = "tasks/scripts/docker-build-image.sh supervisor"
28+
description = "Alias → build:container:supervisor"
29+
depends = ["build:container:supervisor"]
3230
hide = true
3331

3432
["docker:build:gateway"]
35-
description = "Alias for build:docker:gateway"
36-
depends = ["build:docker:gateway"]
33+
description = "Alias → build:container:gateway"
34+
depends = ["build:container:gateway"]
3735
hide = true
3836

3937
["docker:build:supervisor"]
40-
description = "Alias for build:docker:supervisor"
41-
depends = ["build:docker:supervisor"]
38+
description = "Alias → build:container:supervisor"
39+
depends = ["build:container:supervisor"]
4240
hide = true
4341

4442
["build:docker:multiarch"]
45-
description = "Build multi-arch gateway and supervisor images and push to a registry"
46-
run = "tasks/scripts/docker-publish-multiarch.sh"
43+
description = "Alias → build:container:multiarch"
44+
depends = ["build:container:multiarch"]
4745
hide = true
4846

4947
["docker:build:multiarch"]
50-
description = "Alias for build:docker:multiarch"
51-
depends = ["build:docker:multiarch"]
48+
description = "Alias → build:container:multiarch"
49+
depends = ["build:container:multiarch"]
5250
hide = true
5351

5452
["docker:cleanup"]
55-
description = "Remove stale images, volumes, and build cache not used by current deployments"
56-
run = "scripts/docker-cleanup.sh --force"
53+
description = "Alias → container:cleanup"
54+
depends = ["container:cleanup"]
5755

5856
["docker:cleanup:dry-run"]
59-
description = "Preview what docker:cleanup would remove without deleting anything"
60-
run = "scripts/docker-cleanup.sh --dry-run"
57+
description = "Alias → container:cleanup:dry-run"
58+
depends = ["container:cleanup:dry-run"]

‎tasks/python.toml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,10 @@ CARGO_TARGET_CACHE_SCOPE=$(printf '%s' "$CACHE_SCOPE_INPUT" | sha256_16_stdin)
174174
175175
mkdir -p target/wheels
176176
177+
CONTAINERFILE=$(ce_resolve_containerfile deploy/docker python-wheels-macos)
178+
177179
ce build \
178-
-f deploy/docker/Dockerfile.python-wheels-macos \
180+
-f "${CONTAINERFILE}" \
179181
--target wheels \
180182
--build-arg "OSXCROSS_IMAGE=${OSXCROSS_IMAGE_REF}" \
181183
--build-arg "CARGO_TARGET_CACHE_SCOPE=${CARGO_TARGET_CACHE_SCOPE}" \
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,25 @@
33
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
# SPDX-License-Identifier: Apache-2.0
55

6-
# Build the CI Docker image (deploy/docker/Dockerfile.ci).
6+
# Build the CI container image (deploy/docker/Dockerfile.ci or Containerfile.ci).
77
# This is a standalone build, separate from the main image build graph.
88

99
set -euo pipefail
1010

1111
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1212
source "${SCRIPT_DIR}/container-engine.sh"
1313

14+
# Backwards-compatible env var fallbacks: accept CONTAINER_* or DOCKER_*
15+
CONTAINER_BUILDER="${CONTAINER_BUILDER:-${DOCKER_BUILDER:-}}"
16+
CONTAINER_PLATFORM="${CONTAINER_PLATFORM:-${DOCKER_PLATFORM:-}}"
17+
CONTAINER_PUSH="${CONTAINER_PUSH:-${DOCKER_PUSH:-}}"
18+
19+
CONTAINERFILE=$(ce_resolve_containerfile deploy/docker ci)
20+
1421
OUTPUT_ARGS=(--load)
15-
if [[ "${DOCKER_PUSH:-}" == "1" ]]; then
22+
if [[ "${CONTAINER_PUSH}" == "1" ]]; then
1623
OUTPUT_ARGS=(--push)
17-
elif [[ "${DOCKER_PLATFORM:-}" == *","* ]]; then
24+
elif [[ "${CONTAINER_PLATFORM}" == *","* ]]; then
1825
OUTPUT_ARGS=(--push)
1926
fi
2027

@@ -25,11 +32,11 @@ elif [[ -n "${GITHUB_TOKEN:-}" ]]; then
2532
SECRET_ARGS=(--secret id=MISE_GITHUB_TOKEN,env=GITHUB_TOKEN)
2633
fi
2734

28-
exec ce_build \
29-
${DOCKER_BUILDER:+--builder ${DOCKER_BUILDER}} \
30-
${DOCKER_PLATFORM:+--platform ${DOCKER_PLATFORM}} \
35+
ce_build \
36+
${CONTAINER_BUILDER:+--builder ${CONTAINER_BUILDER}} \
37+
${CONTAINER_PLATFORM:+--platform ${CONTAINER_PLATFORM}} \
3138
${SECRET_ARGS[@]+"${SECRET_ARGS[@]}"} \
32-
-f deploy/docker/Dockerfile.ci \
39+
-f "${CONTAINERFILE}" \
3340
-t "openshell/ci:${IMAGE_TAG:-dev}" \
3441
--provenance=false \
3542
"$@" \

0 commit comments

Comments
 (0)