Skip to content

Commit 5803c0b

Browse files
authored
chore(docker): migrate base container images to nvcr.io/nvidia/base/ubuntu:noble-20251013 (#245)
Migrate all production container runtime stages from Debian/Ubuntu upstream to NVIDIA's hardened Ubuntu base image for supply chain consistency. - Dockerfile.ci: ubuntu:24.04 -> nvidia base - Dockerfile.server: debian:bookworm-slim -> nvidia base (runtime stage) - Dockerfile.base (sandbox): python:3.12-slim-bookworm -> nvidia base with system Python 3.12 from Ubuntu Noble repos - Dockerfile.cluster: convert from single-stage rancher/k3s to multistage build extracting k3s artifacts onto nvidia base Closes #244
1 parent 2be5286 commit 5803c0b

File tree

4 files changed

+68
-13
lines changed

4 files changed

+68
-13
lines changed

deploy/docker/Dockerfile.ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# CI runner image with all development tools pre-installed
77
# Rebuild triggered automatically when mise.toml or this file changes
88

9-
FROM ubuntu:24.04
9+
FROM nvcr.io/nvidia/base/ubuntu:noble-20251013
1010

1111
ARG DOCKER_VERSION=29.3.0
1212
ARG BUILDX_VERSION=v0.32.1

deploy/docker/Dockerfile.cluster

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
# k3s cluster image with OpenShell Helm charts and manifests
55
#
6-
# This image is based on k3s and includes:
6+
# Multi-stage build: extracts k3s artifacts from the upstream rancher/k3s
7+
# Alpine image and layers them onto the NVIDIA Ubuntu base image.
8+
#
9+
# This image includes:
10+
# - k3s binary and all supporting binaries (containerd-shim, runc, CNI, etc.)
711
# - Packaged OpenShell Helm chart
812
# - HelmChart CR for auto-deploying OpenShell
913
# - Custom entrypoint for DNS configuration in Docker environments
@@ -23,15 +27,63 @@
2327
# GHSA-9h8m-3fm2-qjrq otel/sdk v1.39.0 (macOS-only PATH hijack; N/A for Linux)
2428
# CVE-2024-36623 docker/docker v25.0.8 (streamformatter race condition)
2529
# Bump K3S_VERSION when a release with updated dependencies ships.
30+
31+
# ---------------------------------------------------------------------------
32+
# Stage 1: Extract k3s artifacts from upstream rancher image (Alpine-based)
33+
# ---------------------------------------------------------------------------
2634
ARG K3S_VERSION=v1.35.2-k3s1
27-
FROM rancher/k3s:${K3S_VERSION}
35+
FROM rancher/k3s:${K3S_VERSION} AS k3s
36+
37+
# ---------------------------------------------------------------------------
38+
# Stage 2: Runtime on NVIDIA hardened Ubuntu base
39+
# ---------------------------------------------------------------------------
40+
FROM nvcr.io/nvidia/base/ubuntu:noble-20251013
41+
42+
# Install runtime dependencies that k3s expects from the host OS.
43+
# - iptables: used by flannel/kube-proxy for network policy and NAT rules
44+
# - mount/umount: needed by kubelet for volume mounts (provided by mount package)
45+
# - ca-certificates: TLS verification for registry pulls
46+
# - conntrack: k3s/kube-proxy uses conntrack for connection tracking
47+
# - dnsutils: nslookup used by entrypoint/healthcheck for DNS probe
48+
RUN apt-get update && apt-get install -y --no-install-recommends \
49+
ca-certificates \
50+
iptables \
51+
mount \
52+
dnsutils \
53+
&& rm -rf /var/lib/apt/lists/*
54+
55+
# Copy the full /bin directory from k3s (contains all statically-linked
56+
# binaries and their symlinks: k3s, kubectl, crictl, ctr, containerd,
57+
# containerd-shim-runc-v2, runc, cni plugins, busybox, coreutils,
58+
# ip, ipset, conntrack, nsenter, pigz, etc.)
59+
COPY --from=k3s /bin/ /bin/
60+
61+
# Copy iptables/nftables tooling (xtables-nft-multi, iptables-detect.sh, etc.)
62+
# These are in /bin/aux/ in the k3s image and must be on PATH.
63+
# Note: the Ubuntu iptables package provides /usr/sbin/iptables, but k3s
64+
# expects its own bundled version at /bin/aux/iptables. Both are on PATH;
65+
# k3s finds its copy via /bin/aux in PATH.
66+
67+
# Copy CA certificates from k3s (bundled Alpine CA bundle).
68+
# The Ubuntu ca-certificates package also installs certs; having both is fine.
69+
COPY --from=k3s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/k3s-ca-certificates.crt
70+
71+
# Copy timezone data used by k3s/Go for time.LoadLocation
72+
COPY --from=k3s /usr/share/zoneinfo/ /usr/share/zoneinfo/
73+
74+
# Set environment variables matching the upstream k3s image.
75+
# PATH includes /bin/aux for iptables tooling and /var/lib/rancher/k3s/data/cni
76+
# for runtime-extracted CNI binaries.
77+
ENV PATH="/var/lib/rancher/k3s/data/cni:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/bin/aux" \
78+
CRI_CONFIG_FILE="/var/lib/rancher/k3s/agent/etc/crictl.yaml"
2879

2980
# Create directories for manifests, charts, and configuration
3081
RUN mkdir -p /var/lib/rancher/k3s/server/manifests \
3182
/var/lib/rancher/k3s/server/static/charts \
3283
/etc/rancher/k3s \
3384
/opt/openshell/manifests \
34-
/opt/openshell/charts
85+
/opt/openshell/charts \
86+
/run/flannel
3587

3688
# Copy entrypoint script that configures DNS for Docker environments
3789
# This script detects the host gateway IP and configures CoreDNS to use it

deploy/docker/Dockerfile.server

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ RUN --mount=type=cache,id=cargo-registry-server-${TARGETARCH},sharing=locked,tar
7979
cp "$(cross_output_dir release)/navigator-server" /build/navigator-server
8080

8181
# Stage 2: Runtime (uses target platform)
82-
# Pin to specific Debian point release for reproducible builds.
83-
FROM debian:bookworm-20260223-slim AS runtime
82+
# NVIDIA hardened Ubuntu base for supply chain consistency.
83+
FROM nvcr.io/nvidia/base/ubuntu:noble-20251013 AS runtime
8484

8585
RUN apt-get update && apt-get install -y --no-install-recommends \
8686
ca-certificates && rm -rf /var/lib/apt/lists/*

deploy/docker/sandbox/Dockerfile.base

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,24 @@ RUN --mount=type=cache,id=cargo-registry-sandbox-${TARGETARCH},sharing=locked,ta
8686
cp "$(cross_output_dir "$RUST_BUILD_PROFILE")/navigator-sandbox" /build/out/
8787

8888
# Stage 2: Python base (uses target platform)
89-
# Pin to specific Python patch + Debian release for reproducible builds.
90-
# CVE-2025-13836 (stdlib urllib Content-Length OOM) affects Python <= 3.12.13;
91-
# update to python:3.12.14-slim-bookworm (or later) when released.
92-
FROM python:3.12.13-slim-bookworm AS base
89+
# NVIDIA hardened Ubuntu base for supply chain consistency.
90+
# Ubuntu Noble ships Python 3.12 natively; install from default repos.
91+
FROM nvcr.io/nvidia/base/ubuntu:noble-20251013 AS base
9392

9493
ENV PYTHONDONTWRITEBYTECODE=1 \
9594
PYTHONUNBUFFERED=1
9695

9796
WORKDIR /sandbox
9897

99-
# Install system dependencies
100-
# iproute2 is needed for network namespace management (ip netns, veth pairs)
98+
# Install Python 3.12 and system dependencies.
99+
# python3.12-venv provides the venv module (required by uv venv).
100+
# iproute2 is needed for network namespace management (ip netns, veth pairs).
101101
RUN apt-get update && apt-get install -y --no-install-recommends \
102+
python3.12 python3.12-venv python3.12-dev python3-pip \
102103
curl dnsutils iproute2 iputils-ping \
103104
net-tools netcat-openbsd traceroute \
105+
&& ln -sf /usr/bin/python3.12 /usr/local/bin/python3 \
106+
&& ln -sf /usr/bin/python3.12 /usr/local/bin/python \
104107
&& rm -rf /var/lib/apt/lists/*
105108

106109
# Create supervisor and sandbox users/groups
@@ -135,7 +138,7 @@ FROM base AS coding-agents
135138
# CVE-2026-21637, CVE-2025-59466, CVE-2025-59465, CVE-2025-55131 affect
136139
# Node.js <= 22.22.1. Update to 22.23.0+ when a patched release ships.
137140
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
138-
apt-get install -y --no-install-recommends build-essential git nodejs=22.22.1-1nodesource1 python3 nano && \
141+
apt-get install -y --no-install-recommends build-essential git nodejs=22.22.1-1nodesource1 nano && \
139142
rm -rf /var/lib/apt/lists/*
140143

141144
# Install GitHub CLI (gh) from the official apt repository

0 commit comments

Comments
 (0)