Skip to content

Commit e466610

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 689835c commit e466610

24 files changed

Lines changed: 410 additions & 313 deletions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ jobs:
226226
DOCKER_BUILDER: openshell
227227
run: |
228228
set -euo pipefail
229-
mise exec -- tasks/scripts/docker-build-image.sh "${{ inputs.component }}" \
229+
mise exec -- tasks/scripts/container-build-image.sh "${{ inputs.component }}" \
230230
--cache-from "type=gha,scope=${{ inputs.component }}-${{ matrix.arch }}" \
231231
--cache-to "type=gha,mode=max,scope=${{ inputs.component }}-${{ matrix.arch }}"
232232

‎AGENTS.md‎

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

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

182-
## Docker
182+
## Containers
183183

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

186186
## Cluster Infrastructure Changes
187187

‎architecture/build-containers.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The chart remains the supported deployment artifact for Kubernetes.
3030

3131
`deploy/docker/Dockerfile.images` no longer compiles Rust. CI calls `.github/workflows/shadow-rust-native-build.yml` through `workflow_call` to build `openshell-gateway` or `openshell-sandbox` natively on the target architecture. `.github/workflows/docker-build.yml` downloads the resulting artifact, stages it at `deploy/docker/.build/prebuilt-binaries/<arch>/`, builds the per-arch image with the local Buildx driver, and merges multi-arch pushes with `docker buildx imagetools create`. Callers normally publish the GitHub SHA tag, but can pass `image-tag` to publish isolated temporary tags for validation.
3232

33-
Local image builds use `tasks/scripts/stage-prebuilt-binaries.sh` through `tasks/scripts/docker-build-image.sh` before invoking Docker, so clean checkouts do not need to create the staging directory manually.
33+
Local image builds use `tasks/scripts/stage-prebuilt-binaries.sh` through `tasks/scripts/container-build-image.sh` before invoking Docker, so clean checkouts do not need to create the staging directory manually.
3434

3535
## Supervisor Delivery
3636

‎crates/openshell-cli/src/doctor_llm_prompt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ If DNS is broken, all image pulls from the distribution registry will fail, as w
280280
| `tls handshake eof` from `openshell status` | Server not running or mTLS credentials missing/mismatched | Check StatefulSet replicas (Step 3) and mTLS files (Step 6) |
281281
| StatefulSet `0/0` replicas | StatefulSet scaled to zero (failed deploy, manual scale-down, or Helm misconfiguration) | `openshell doctor exec -- kubectl -n openshell scale statefulset openshell --replicas=1` |
282282
| Local mTLS files missing | Deploy was interrupted before credentials were persisted | Extract from cluster secret `openshell-client-tls` (Step 6) |
283-
| Container not found | Image not built | `mise run docker:build:cluster` (local) or re-deploy (remote) |
283+
| Container not found | Image not built | `mise run build:container:cluster` (local) or re-deploy (remote) |
284284
| Container exited, OOMKilled | Insufficient memory | Increase host memory or reduce workload |
285285
| Container exited, non-zero exit | k3s crash, port conflict, privilege issue | Check `openshell doctor logs` for details |
286286
| `/readyz` fails | k3s still starting or crashed | Wait longer or check container logs for k3s errors |

‎crates/openshell-vm/scripts/build-rootfs.sh‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ fi
8181

8282
case "$GUEST_ARCH" in
8383
aarch64)
84-
DOCKER_PLATFORM="linux/arm64"
84+
CONTAINER_PLATFORM="linux/arm64"
8585
K3S_BINARY_SUFFIX="-arm64"
8686
K3S_CHECKSUM_VAR="K3S_ARM64_SHA256"
8787
RUST_TARGET="aarch64-unknown-linux-gnu"
8888
;;
8989
x86_64)
90-
DOCKER_PLATFORM="linux/amd64"
90+
CONTAINER_PLATFORM="linux/amd64"
9191
K3S_BINARY_SUFFIX="" # x86_64 binary has no suffix
9292
K3S_CHECKSUM_VAR="K3S_AMD64_SHA256"
9393
RUST_TARGET="x86_64-unknown-linux-gnu"
@@ -294,7 +294,7 @@ fi
294294
ce rm -f "${CONTAINER_NAME}" 2>/dev/null || true
295295

296296
echo "==> Building base image..."
297-
ce build --platform "${DOCKER_PLATFORM}" -t "${BASE_IMAGE_TAG}" \
297+
ce build --platform "${CONTAINER_PLATFORM}" -t "${BASE_IMAGE_TAG}" \
298298
--build-arg "BASE_IMAGE=${VM_BASE_IMAGE}" -f - . <<'DOCKERFILE'
299299
ARG BASE_IMAGE
300300
FROM ${BASE_IMAGE}
@@ -318,7 +318,7 @@ DOCKERFILE
318318

319319
# Create a container and export the filesystem
320320
echo "==> Creating container..."
321-
ce create --platform "${DOCKER_PLATFORM}" --name "${CONTAINER_NAME}" "${BASE_IMAGE_TAG}" /bin/true
321+
ce create --platform "${CONTAINER_PLATFORM}" --name "${CONTAINER_NAME}" "${BASE_IMAGE_TAG}" /bin/true
322322

323323
echo "==> Exporting filesystem..."
324324
# Previous builds may leave overlayfs work/ dirs with permissions that
@@ -513,7 +513,7 @@ pull_and_save() {
513513
# Try to pull; if the registry is unavailable, fall back to the
514514
# local Docker image cache (image may exist from a previous pull).
515515
echo " pulling: ${image}..."
516-
if ! ce pull --platform "${DOCKER_PLATFORM}" "${image}" --quiet 2>/dev/null; then
516+
if ! ce pull --platform "${CONTAINER_PLATFORM}" "${image}" --quiet 2>/dev/null; then
517517
echo " pull failed, checking local image cache..."
518518
if ! ce image inspect "${image}" >/dev/null 2>&1; then
519519
echo "ERROR: image ${image} not available locally or from registry"

‎e2e/with-docker-gateway.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ else
342342
CONTAINER_ENGINE=docker \
343343
DOCKER_PLATFORM="linux/${DAEMON_ARCH}" \
344344
DOCKER_OUTPUT="type=local,dest=${SUPERVISOR_OUT_DIR}" \
345-
bash "${ROOT}/tasks/scripts/docker-build-image.sh" supervisor-output
345+
bash "${ROOT}/tasks/scripts/container-build-image.sh" supervisor-output
346346
fi
347347

348348
if [ ! -f "${SUPERVISOR_BIN}" ]; then

‎scripts/build-benchmark/cluster-deploy-fast-test.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ run_fast_deploy() {
230230
BUILDKIT_PROGRESS=plain \
231231
CLUSTER_NAME="${CLUSTER_NAME}" \
232232
DEPLOY_FAST_STATE_FILE="${state_file}" \
233-
DOCKER_BUILD_CACHE_DIR="${CACHE_DIR}" \
233+
CONTAINER_BUILD_CACHE_DIR="${CACHE_DIR}" \
234234
"$@" \
235235
mise run cluster
236236
) >"${log_file}" 2>&1 || true
@@ -252,7 +252,7 @@ run_fast_deploy_args() {
252252
BUILDKIT_PROGRESS=plain \
253253
CLUSTER_NAME="${CLUSTER_NAME}" \
254254
DEPLOY_FAST_STATE_FILE="${state_file}" \
255-
DOCKER_BUILD_CACHE_DIR="${CACHE_DIR}" \
255+
CONTAINER_BUILD_CACHE_DIR="${CACHE_DIR}" \
256256
mise run cluster -- "$@"
257257
) >"${log_file}" 2>&1 || true
258258
end=$(date +%s)
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

‎scripts/remote-deploy.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ rm -f .env
235235
echo "==> Building container images (tag=${IMAGE_TAG})..."
236236
export OPENSHELL_CARGO_VERSION="${CARGO_VERSION}"
237237
export IMAGE_TAG
238-
mise exec -- tasks/scripts/docker-build-image.sh cluster
239-
mise exec -- tasks/scripts/docker-build-image.sh gateway
238+
mise exec -- tasks/scripts/container-build-image.sh cluster
239+
mise exec -- tasks/scripts/container-build-image.sh gateway
240240
241241
export OPENSHELL_CLUSTER_IMAGE="openshell/cluster:${IMAGE_TAG}"
242242
export OPENSHELL_PUSH_IMAGES="openshell/gateway:${IMAGE_TAG}"

‎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"

0 commit comments

Comments
 (0)