Skip to content

build(devcontainer): use the published image and drop cache volumes #4248

Closed

Description

@dan-petty

Problem or Motivation

.devcontainer/devcontainer.json builds the image of this repository on each workstation: it builds .devcontainer/Dockerfile and installs 7 Dev Container Features. .devcontainer/image/devcontainer.json holds the same build for the published image ghcr.io/dan-petty/devops-cli/devcontainer (#2309). The two files have the same features, the same lock file, and the same containerEnv except UV_CACHE_DIR. Each change to the image must be made two times, and each "Rebuild Container" runs apt on debian:sid and all 7 features again.

Proposed Solution & Architectural Design

Use the published image in the workspace configuration, the "prebuilt image" pattern of the Dev Containers specification (https://containers.dev/guide/prebuild):

  • .devcontainer/devcontainer.json: replace build with "image": "ghcr.io/dan-petty/devops-cli/devcontainer:latest", the tag that devops devcontainer init gives child repositories. Remove features and every containerEnv entry that the image label holds. Keep UV_CACHE_DIR, the mounts, runArgs, the remoteEnv PATH, the lifecycle commands and the customizations.
  • Delete .devcontainer/devcontainer-lock.json, which is equal to .devcontainer/image/devcontainer-lock.json.
  • Remove the five cache volumes (.venv, .mypy_cache, .pytest_cache, .ruff_cache, .uv) and UV_CACHE_DIR. They were for a workspace on a slow Windows mount. The workspace is now on the WSL file system, on the same ext4 device as the volumes, so the volumes give no speed. All five folders are in .gitignore; post-create fills .venv again with uv sync, and uv keeps its cache in the home volume.
  • Keep the mounts that hold data: the .data volume, the home volume, the .ssh bind mount and the /tmp volume. An invariant test fails if one of them leaves the workspace configuration.
  • .devcontainer/image/devcontainer.json and the Dockerfile stay the one build definition. CI builds and smoke-tests it on each pull request that changes .devcontainer or src, and the release publishes it.
  • Add an invariant test: the workspace configuration names the published image and repeats no feature and no containerEnv entry of the image configuration.
  • Update docs/DEVCONTAINER_USAGE.md: this repository uses the published image, podman pull the tag before a rebuild to get a newer release, how to try an image change before a release, and how to remove the old cache volumes by name (never with a prune, which can remove the .data and home volumes while no container uses them).

Evidence (2026-11-09): the devcontainer.metadata label of the published latest (v0.101.0, amd64, anonymous pull) holds all 7 features with their runtime properties (docker-in-docker: privileged, entrypoint, a mount), remoteUser: vscode, and the full containerEnv, with ${containerWorkspaceFolder} left for the container start to resolve.

Trade-offs: an image change reaches this workspace only after a release publishes it; the first post-create runs the release's devops copy before .venv takes over (as in child repositories).

Target Subsystem

devcontainer

Existing Tool Considered

The Dev Containers CLI image metadata label (devcontainer.metadata) and the prebuild pattern of the specification. The change deletes configuration and builds nothing.

Standards Compliance

  • I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 5, zero bare exceptions, tests that cover the changed lines).
  • I am willing to submit a pull request implementing this feature with accompanying tests.

Activity

  1. added
    source/agent
    type/infra
    scope/devcontainer
    status/new
    value/medium
    effort/medium
    on Nov 9, 2026
  2. dan-petty commented on Nov 9, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/infra. The build prefix of the title gives the type.
    • Scope: scope/devcontainer. The (devcontainer) scope of the title gives the scope.
    • Priority: P2-Medium. It removes duplicate config and rebuild time for every developer but the current setup still works.
    • Value: Medium. Developers save build time and maintain one source of truth for the image, reducing drift.
    • Effort: Medium. It edits one JSON file, deletes a lock file, adds one invariant test, and updates one doc page.
    • Related: feat(cli): oci container image packaging, standardized metadata & ghcr package integration #438, which asks for a different change. Both concern the devcontainer image on GHCR, but #438 adds OCI metadata to the published image while this candidate changes the workspace config to consume that image.
  3. added
    priority/p2-medium
    on Nov 9, 2026
  4. changed the title [-]build(devcontainer): use the published image in the workspace devcontainer[/-] [+]build(devcontainer): use the published image and drop cache volumes[/+] on Nov 9, 2026
  5. added
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 9, 2026
  6. added 2 commits that reference this issue on Nov 9, 2026
    260c3fc
    a19a3b7
  7. removed
    status/in-progress
    owner/agent
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/devcontainersource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions