Skip to content

Image size: slim the base image + audit unconditional apt packages (saves 400-600MB) #11

Description

@ai-anant

Problem

mcr.microsoft.com/devcontainers/base:ubuntu-24.04 brings ~600 MB of devcontainer features (git feature 393 MB, common-utils 203 MB) that aidc barely uses — it manages its own users (vscode), PATH, git config, and toolchain wiring. Measured contribution to the 3.22 GB floor: ~596 MB (393 + 203 MB feature layers) plus the base ubuntu layer.

aidc only actually needs from the base image:

  • a vscode user + sudo
  • git, curl, ca-certificates, common build basics
  • a working apt

Proposal A: slimmer base image (recommended)

Evaluate switching the base to a slimmer image, e.g.:

  • ubuntu:24.04 (digest-pinned) + a small layer that creates the vscode user (uid 1000), installs sudo, git, curl, ca-certificates, and the handful of apt packages the Dockerfile already installs.
  • Or ghcr.io/devcontainers/base:ubuntu-24.04ubuntu:24.04 with the devcontainer feature layers dropped.

Expected saving: 400–600 MB off every image.

Proposal B (cheaper, still worth it): drop unused apt packages

Audit the apt list — candidates for removal/trimming:

  • build-essential (~150 MB with deps) — only needed if the project compiles C; make it part of toolchain installs or project-setup.sh instead of unconditional.
  • vim, nano, tmux, zsh, fzf, fd-find — nice-to-haves; consider keeping but documenting, or moving to an "interactive" build arg.
  • ipset, iptables, iproute2, dnsutils, socat, bubblewrap — needed for the firewall/clipboard features; keep.
  • nodejs (from nodesource) — installed unconditionally; only needed when AIDC_TOOLCHAINS includes node (or npm/pnpm/yarn/bun runtimes). Move to the toolchain block (~70 MB saving on non-node projects).

Keep the ones with real functions (gh, jq, ripgrep, rsync, unzip/xz/zip, gnupg, curl, ca-certificates).

Files

  • templates/devcontainer/Dockerfile.tmplFROM line + apt block

Acceptance criteria

  • Base + apt + uv/python + agents + scanners image ≤ ~2.5 GB (from 3.22 GB) before any toolchain changes.
  • aidc up --clipboard (socat), firewall (iptables/ipset), and clipboard bridge still work.
  • vscode user, sudo, git config overlay all still function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions