diff --git a/README.md b/README.md index e4359b1..81422c8 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,11 @@ Applying a template writes a `.devcontainer/devcontainer.json` into your project "source": "${devcontainerId}-uv-cache", "target": "/home/dev/.cache/uv", "type": "volume" + }, + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { @@ -83,7 +88,7 @@ Each part maps to one of the goals above: - `image` references a base image from [Bare Dev Container Images], a separate repository that builds minimal images with pinned digests, SLSA provenance, and an SPDX SBOM. This repository ships configuration only; what is installed inside the container is documented there. - `remoteUser`, `runArgs`, `securityOpt`, and `init` are the shared hardening defaults, applied identically by every template. -- `mounts` persists the toolchain's cache directories in named volumes, so rebuilding to pick up an image update doesn't re-download dependencies. +- `mounts` persists the toolchain's cache directories in named volumes, so rebuilding to pick up an image update doesn't re-download dependencies. A further volume holds the bash history the image writes, so a rebuild doesn't clear it. - `customizations` pairs the toolchain with the relevant extensions and settings, so the editor is ready to use on first open. The generated file is yours to edit — it is a plain dev container configuration, so you can layer [Features](https://containers.dev/features), add mounts, or relax any of the defaults. diff --git a/src/bun/.devcontainer/devcontainer.json b/src/bun/.devcontainer/devcontainer.json index a208cde..94109f0 100644 --- a/src/bun/.devcontainer/devcontainer.json +++ b/src/bun/.devcontainer/devcontainer.json @@ -23,6 +23,12 @@ "source": "${devcontainerId}-bun-install-cache", "target": "/home/dev/.bun/install/cache", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/bun/NOTES.md b/src/bun/NOTES.md index 33da37a..d6e5d86 100644 --- a/src/bun/NOTES.md +++ b/src/bun/NOTES.md @@ -21,11 +21,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -Bun's global install cache is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading packages: +Bun's global install cache is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading packages. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-bun-install-cache` | `/home/dev/.bun/install/cache` | Bun's global install cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/bun/README.md b/src/bun/README.md index 83064fd..0a2a2ba 100644 --- a/src/bun/README.md +++ b/src/bun/README.md @@ -32,11 +32,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -Bun's global install cache is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading packages: +Bun's global install cache is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading packages. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-bun-install-cache` | `/home/dev/.bun/install/cache` | Bun's global install cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/bun/devcontainer-template.json b/src/bun/devcontainer-template.json index aedd4e7..eb8a6e4 100644 --- a/src/bun/devcontainer-template.json +++ b/src/bun/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "bun", - "version": "1.0.8", + "version": "1.1.0", "name": "Bun", "description": "Security-focused Bun dev container for JS/TS with hardened defaults and cached installs.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/debian/.devcontainer/devcontainer.json b/src/debian/.devcontainer/devcontainer.json index f703cf2..bdfa379 100644 --- a/src/debian/.devcontainer/devcontainer.json +++ b/src/debian/.devcontainer/devcontainer.json @@ -10,11 +10,19 @@ "runArgs": ["--cap-drop=ALL"], // Remove "no-new-privileges" if users need to gain elevated privileges inside the container (e.g., su, sudo). "securityOpt": ["no-new-privileges"], - "init": true + "init": true, // If you use VS Code, uncomment the following to open $EDITOR/$VISUAL/$GIT_EDITOR (e.g. `git commit`) in a VS Code tab: // "remoteEnv": { // "VISUAL": "code --wait", // "EDITOR": "code --wait", // "GIT_EDITOR": "code --wait" - // } + // }, + "mounts": [ + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" + } + ] } diff --git a/src/debian/NOTES.md b/src/debian/NOTES.md index 9498baf..9bbdab0 100644 --- a/src/debian/NOTES.md +++ b/src/debian/NOTES.md @@ -27,6 +27,16 @@ This template is a minimal Debian base for any development stack — no language - extend the image with your own `Dockerfile`, or - switch to a stack-specific Bare Dev Container template (Go, Rust, Node.js, ...). +## Persistent Caches + +Bash history is persisted in a named volume, so rebuilding the container to pick up image updates doesn't clear it: + +| Volume | Mount path | Purpose | +|--------|------------|---------| +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. + ## Tips - If you use VS Code, uncomment the `remoteEnv` block in `devcontainer.json` to open `$EDITOR`/`$VISUAL`/`$GIT_EDITOR` (e.g. `git commit`) in a VS Code tab. diff --git a/src/debian/README.md b/src/debian/README.md index 84c81cb..c5c1881 100644 --- a/src/debian/README.md +++ b/src/debian/README.md @@ -38,6 +38,16 @@ This template is a minimal Debian base for any development stack — no language - extend the image with your own `Dockerfile`, or - switch to a stack-specific Bare Dev Container template (Go, Rust, Node.js, ...). +## Persistent Caches + +Bash history is persisted in a named volume, so rebuilding the container to pick up image updates doesn't clear it: + +| Volume | Mount path | Purpose | +|--------|------------|---------| +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. + ## Tips - If you use VS Code, uncomment the `remoteEnv` block in `devcontainer.json` to open `$EDITOR`/`$VISUAL`/`$GIT_EDITOR` (e.g. `git commit`) in a VS Code tab. diff --git a/src/debian/devcontainer-template.json b/src/debian/devcontainer-template.json index d085d01..87c2a21 100644 --- a/src/debian/devcontainer-template.json +++ b/src/debian/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "debian", - "version": "1.2.7", + "version": "1.3.0", "name": "Debian", "description": "Security-focused minimal Debian base for any stack, with hardened, non-root defaults.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/deno/.devcontainer/devcontainer.json b/src/deno/.devcontainer/devcontainer.json index db52586..9cc9398 100644 --- a/src/deno/.devcontainer/devcontainer.json +++ b/src/deno/.devcontainer/devcontainer.json @@ -23,6 +23,12 @@ "source": "${devcontainerId}-deno-cache", "target": "/home/dev/.cache/deno", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/deno/NOTES.md b/src/deno/NOTES.md index fa2aba2..612da06 100644 --- a/src/deno/NOTES.md +++ b/src/deno/NOTES.md @@ -21,11 +21,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -Deno's cache directory (`DENO_DIR`) is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading remote modules or npm packages: +Deno's cache directory (`DENO_DIR`) is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading remote modules or npm packages. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-deno-cache` | `/home/dev/.cache/deno` | Deno's cache (`DENO_DIR`): remote modules and npm packages | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/deno/README.md b/src/deno/README.md index 85d6b31..a62ffac 100644 --- a/src/deno/README.md +++ b/src/deno/README.md @@ -32,11 +32,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -Deno's cache directory (`DENO_DIR`) is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading remote modules or npm packages: +Deno's cache directory (`DENO_DIR`) is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading remote modules or npm packages. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-deno-cache` | `/home/dev/.cache/deno` | Deno's cache (`DENO_DIR`): remote modules and npm packages | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/deno/devcontainer-template.json b/src/deno/devcontainer-template.json index 256cc58..ad18081 100644 --- a/src/deno/devcontainer-template.json +++ b/src/deno/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "deno", - "version": "1.0.3", + "version": "1.1.0", "name": "Deno", "description": "Security-focused Deno dev container for JS/TS with hardened defaults and cached modules.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/golang/.devcontainer/devcontainer.json b/src/golang/.devcontainer/devcontainer.json index d61d4fd..689ebc1 100644 --- a/src/golang/.devcontainer/devcontainer.json +++ b/src/golang/.devcontainer/devcontainer.json @@ -31,6 +31,12 @@ "source": "${devcontainerId}-golang-build-cache", "target": "/home/dev/.cache/go-build", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/golang/NOTES.md b/src/golang/NOTES.md index 57049eb..e823edc 100644 --- a/src/golang/NOTES.md +++ b/src/golang/NOTES.md @@ -21,12 +21,15 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -The Go module and build caches are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading modules or recompiling packages: +The Go module and build caches are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading modules or recompiling packages. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-golang-pkg-mod` | `/home/dev/go/pkg/mod` | Go module cache (`GOMODCACHE`) | | `${devcontainerId}-golang-build-cache` | `/home/dev/.cache/go-build` | Go build cache (`GOCACHE`) | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/golang/README.md b/src/golang/README.md index ec59c4e..bbe3195 100644 --- a/src/golang/README.md +++ b/src/golang/README.md @@ -32,12 +32,15 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -The Go module and build caches are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading modules or recompiling packages: +The Go module and build caches are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading modules or recompiling packages. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-golang-pkg-mod` | `/home/dev/go/pkg/mod` | Go module cache (`GOMODCACHE`) | | `${devcontainerId}-golang-build-cache` | `/home/dev/.cache/go-build` | Go build cache (`GOCACHE`) | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/golang/devcontainer-template.json b/src/golang/devcontainer-template.json index c60d7e4..fad98da 100644 --- a/src/golang/devcontainer-template.json +++ b/src/golang/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "golang", - "version": "1.3.1", + "version": "1.4.0", "name": "Go", "description": "Security-focused Go dev container with hardened defaults and rebuild-friendly caches.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/mise/.devcontainer/devcontainer.json b/src/mise/.devcontainer/devcontainer.json index 2f16de4..fc83e5d 100644 --- a/src/mise/.devcontainer/devcontainer.json +++ b/src/mise/.devcontainer/devcontainer.json @@ -29,6 +29,12 @@ "source": "${devcontainerId}-mise-cache", "target": "/home/dev/.cache/mise", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ] } diff --git a/src/mise/NOTES.md b/src/mise/NOTES.md index 378dc3e..4d28b77 100644 --- a/src/mise/NOTES.md +++ b/src/mise/NOTES.md @@ -4,7 +4,7 @@ See [Getting Started](https://github.com/bare-devcontainer/templates#getting-sta ## Image Variants -The `imageVariant` option selects the tag of the `ghcr.io/bare-devcontainer/mise` base image, which tracks the Debian release: `trixie` is Debian 13 and `bookworm` is Debian 12. +The `imageVariant` option selects the tag of the `ghcr.io/bare-devcontainer/mise` base image, which tracks the Debian release: `trixie` is Debian 13. The values offered when applying the template are proposals, not a closed list — any published tag can be entered, including narrower ones such as a mise version or a dated build for tighter pinning. See the [published tags](https://github.com/orgs/bare-devcontainer/packages/container/package/mise) for what is currently available. @@ -32,12 +32,15 @@ The installed runtimes are stored in the persisted data volume, so they remain a ## Persistent Caches -mise's data directory and download cache are persisted in named volumes, so toolchains installed with mise survive container rebuilds and don't need to be re-downloaded: +mise's data directory and download cache are persisted in named volumes, so toolchains installed with mise survive container rebuilds and don't need to be re-downloaded. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-mise-data` | `/home/dev/.local/share/mise` | mise-managed toolchains | | `${devcontainerId}-mise-cache` | `/home/dev/.cache/mise` | mise's download cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Tips diff --git a/src/mise/README.md b/src/mise/README.md index 0bdc50c..20b2679 100644 --- a/src/mise/README.md +++ b/src/mise/README.md @@ -7,7 +7,7 @@ Security-focused mise dev container for multiple runtimes, with cached tool inst | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| -| imageVariant | Debian version (trixie = Debian 13, bookworm = Debian 12). Other published tags can be entered. | string | trixie | +| imageVariant | Debian version (trixie = Debian 13). Other published tags can be entered. | string | trixie | ## Getting Started @@ -15,7 +15,7 @@ See [Getting Started](https://github.com/bare-devcontainer/templates#getting-sta ## Image Variants -The `imageVariant` option selects the tag of the `ghcr.io/bare-devcontainer/mise` base image, which tracks the Debian release: `trixie` is Debian 13 and `bookworm` is Debian 12. +The `imageVariant` option selects the tag of the `ghcr.io/bare-devcontainer/mise` base image, which tracks the Debian release: `trixie` is Debian 13. The values offered when applying the template are proposals, not a closed list — any published tag can be entered, including narrower ones such as a mise version or a dated build for tighter pinning. See the [published tags](https://github.com/orgs/bare-devcontainer/packages/container/package/mise) for what is currently available. @@ -43,12 +43,15 @@ The installed runtimes are stored in the persisted data volume, so they remain a ## Persistent Caches -mise's data directory and download cache are persisted in named volumes, so toolchains installed with mise survive container rebuilds and don't need to be re-downloaded: +mise's data directory and download cache are persisted in named volumes, so toolchains installed with mise survive container rebuilds and don't need to be re-downloaded. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-mise-data` | `/home/dev/.local/share/mise` | mise-managed toolchains | | `${devcontainerId}-mise-cache` | `/home/dev/.cache/mise` | mise's download cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Tips diff --git a/src/mise/devcontainer-template.json b/src/mise/devcontainer-template.json index e390f56..f796bb3 100644 --- a/src/mise/devcontainer-template.json +++ b/src/mise/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "mise", - "version": "1.3.3", + "version": "1.4.0", "name": "mise", "description": "Security-focused mise dev container for multiple runtimes, with cached tool installs.", "publisher": "Bare Dev Container Maintainers", @@ -9,10 +9,9 @@ "options": { "imageVariant": { "type": "string", - "description": "Debian version (trixie = Debian 13, bookworm = Debian 12). Other published tags can be entered.", + "description": "Debian version (trixie = Debian 13). Other published tags can be entered.", "proposals": [ - "trixie", - "bookworm" + "trixie" ], "default": "trixie" } diff --git a/src/node/.devcontainer/devcontainer.json b/src/node/.devcontainer/devcontainer.json index 17212ee..ce9e5f8 100644 --- a/src/node/.devcontainer/devcontainer.json +++ b/src/node/.devcontainer/devcontainer.json @@ -23,6 +23,12 @@ "source": "${devcontainerId}-node-corepack-cache", "target": "/home/dev/.cache/node/corepack", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ] } diff --git a/src/node/NOTES.md b/src/node/NOTES.md index 6299cc8..906856b 100644 --- a/src/node/NOTES.md +++ b/src/node/NOTES.md @@ -21,11 +21,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -Corepack's cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading package managers: +Corepack's cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading package managers. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-node-corepack-cache` | `/home/dev/.cache/node/corepack` | Corepack's cache of downloaded `yarn`/`pnpm` releases | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Tips diff --git a/src/node/README.md b/src/node/README.md index af207a5..153af19 100644 --- a/src/node/README.md +++ b/src/node/README.md @@ -32,11 +32,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -Corepack's cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading package managers: +Corepack's cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading package managers. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-node-corepack-cache` | `/home/dev/.cache/node/corepack` | Corepack's cache of downloaded `yarn`/`pnpm` releases | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Tips diff --git a/src/node/devcontainer-template.json b/src/node/devcontainer-template.json index 26c8f08..babf750 100644 --- a/src/node/devcontainer-template.json +++ b/src/node/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "node", - "version": "1.1.2", + "version": "1.2.0", "name": "Node.js", "description": "Security-focused Node.js dev container for JS/TS with non-root defaults and Corepack.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/opentofu/.devcontainer/devcontainer.json b/src/opentofu/.devcontainer/devcontainer.json index cccba37..1949086 100644 --- a/src/opentofu/.devcontainer/devcontainer.json +++ b/src/opentofu/.devcontainer/devcontainer.json @@ -23,6 +23,12 @@ "source": "${devcontainerId}-opentofu-plugin-cache", "target": "/home/dev/.terraform.d/plugin-cache", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/opentofu/NOTES.md b/src/opentofu/NOTES.md index e672219..282680f 100644 --- a/src/opentofu/NOTES.md +++ b/src/opentofu/NOTES.md @@ -21,11 +21,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -The OpenTofu plugin cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading providers: +The OpenTofu plugin cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading providers. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-opentofu-plugin-cache` | `/home/dev/.terraform.d/plugin-cache` | OpenTofu provider plugin cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/opentofu/README.md b/src/opentofu/README.md index 5839f98..47c52b7 100644 --- a/src/opentofu/README.md +++ b/src/opentofu/README.md @@ -32,11 +32,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -The OpenTofu plugin cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading providers: +The OpenTofu plugin cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading providers. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-opentofu-plugin-cache` | `/home/dev/.terraform.d/plugin-cache` | OpenTofu provider plugin cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/opentofu/devcontainer-template.json b/src/opentofu/devcontainer-template.json index 841acb8..8d5975d 100644 --- a/src/opentofu/devcontainer-template.json +++ b/src/opentofu/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "opentofu", - "version": "1.0.1", + "version": "1.1.0", "name": "OpenTofu", "description": "Security-focused OpenTofu dev container with tofu-ls and a plugin cache volume.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/pnpm/.devcontainer/devcontainer.json b/src/pnpm/.devcontainer/devcontainer.json index a44baf1..a1d755d 100644 --- a/src/pnpm/.devcontainer/devcontainer.json +++ b/src/pnpm/.devcontainer/devcontainer.json @@ -31,6 +31,12 @@ "source": "${devcontainerId}-pnpm-cache", "target": "/home/dev/.cache/pnpm", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/pnpm/NOTES.md b/src/pnpm/NOTES.md index b39c386..a585c4e 100644 --- a/src/pnpm/NOTES.md +++ b/src/pnpm/NOTES.md @@ -51,17 +51,20 @@ To install the pinned runtime and the dependencies when the container is created ## Persistent Caches -pnpm's home directory and metadata cache are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading the runtimes and packages pnpm keeps there: +pnpm's home directory and metadata cache are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading the runtimes and packages pnpm keeps there. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-pnpm-home` | `/home/dev/.local/share/pnpm` | pnpm-managed runtimes, globally installed bins, and the store they are linked from | | `${devcontainerId}-pnpm-cache` | `/home/dev/.cache/pnpm` | pnpm's metadata cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | Where a package store lands is pnpm's decision rather than this template's, because [there is one store per disk](https://pnpm.io/settings/store#storedir) and hard links only work within a single filesystem. Global installs — the pnpm-managed runtimes and anything added with `pnpm add -g` — live on the volume above, so they are linked from the store at `$PNPM_HOME/store` and persist with it. A project in the workspace is usually on a different filesystem, bind-mounted from the host, so pnpm keeps that project's store beside it in `node_modules/.pnpm-store` and hard-links from there instead. `pnpm store path` reports the one in effect where you run it. The consequence worth knowing is that deleting a project's `node_modules` deletes that project's store with it, so the next install re-downloads its packages. The runtimes and global bins are unaffected: they stay in the volume. +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. + ## Editor Integration - Sets VS Code's [`npm.packageManager`](https://github.com/microsoft/vscode/blob/main/extensions/npm/README.md) to `pnpm`, so scripts and dependency installs run through pnpm instead of being guessed from the lockfiles present in the workspace. diff --git a/src/pnpm/README.md b/src/pnpm/README.md index 864188e..32b11e8 100644 --- a/src/pnpm/README.md +++ b/src/pnpm/README.md @@ -62,17 +62,20 @@ To install the pinned runtime and the dependencies when the container is created ## Persistent Caches -pnpm's home directory and metadata cache are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading the runtimes and packages pnpm keeps there: +pnpm's home directory and metadata cache are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading the runtimes and packages pnpm keeps there. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-pnpm-home` | `/home/dev/.local/share/pnpm` | pnpm-managed runtimes, globally installed bins, and the store they are linked from | | `${devcontainerId}-pnpm-cache` | `/home/dev/.cache/pnpm` | pnpm's metadata cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | Where a package store lands is pnpm's decision rather than this template's, because [there is one store per disk](https://pnpm.io/settings/store#storedir) and hard links only work within a single filesystem. Global installs — the pnpm-managed runtimes and anything added with `pnpm add -g` — live on the volume above, so they are linked from the store at `$PNPM_HOME/store` and persist with it. A project in the workspace is usually on a different filesystem, bind-mounted from the host, so pnpm keeps that project's store beside it in `node_modules/.pnpm-store` and hard-links from there instead. `pnpm store path` reports the one in effect where you run it. The consequence worth knowing is that deleting a project's `node_modules` deletes that project's store with it, so the next install re-downloads its packages. The runtimes and global bins are unaffected: they stay in the volume. +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. + ## Editor Integration - Sets VS Code's [`npm.packageManager`](https://github.com/microsoft/vscode/blob/main/extensions/npm/README.md) to `pnpm`, so scripts and dependency installs run through pnpm instead of being guessed from the lockfiles present in the workspace. diff --git a/src/pnpm/devcontainer-template.json b/src/pnpm/devcontainer-template.json index d476f3d..3495b28 100644 --- a/src/pnpm/devcontainer-template.json +++ b/src/pnpm/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "pnpm", - "version": "1.0.0", + "version": "1.1.0", "name": "Node.js (pnpm)", "description": "Security-focused pnpm dev container for JS/TS with pnpm-managed Node.js and caches.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/rustup/.devcontainer/devcontainer.json b/src/rustup/.devcontainer/devcontainer.json index 60ccd17..928c9d7 100644 --- a/src/rustup/.devcontainer/devcontainer.json +++ b/src/rustup/.devcontainer/devcontainer.json @@ -32,6 +32,12 @@ "source": "${devcontainerId}-rustup-cargo-git", "target": "/home/dev/.cargo/git", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/rustup/NOTES.md b/src/rustup/NOTES.md index 663fadd..ed4a659 100644 --- a/src/rustup/NOTES.md +++ b/src/rustup/NOTES.md @@ -21,15 +21,18 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -Cargo's registry and git caches are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading crates: +Cargo's registry and git caches are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading crates. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-rustup-cargo-registry` | `/home/dev/.cargo/registry` | Cargo registry cache | | `${devcontainerId}-rustup-cargo-git` | `/home/dev/.cargo/git` | Cargo's cache of git-sourced dependencies | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | Only `registry/` and `git/` are mounted; `~/.cargo/bin` is intentionally left in the image layer so the toolchain binaries always come from the image. +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. + ## Editor Integration - Installs the `rust-lang.rust-analyzer` VS Code extension, with format-on-save enabled for Rust files. diff --git a/src/rustup/README.md b/src/rustup/README.md index 348c12f..93e4cc4 100644 --- a/src/rustup/README.md +++ b/src/rustup/README.md @@ -32,15 +32,18 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -Cargo's registry and git caches are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading crates: +Cargo's registry and git caches are persisted in named volumes, so rebuilding the container to pick up image updates doesn't require re-downloading crates. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-rustup-cargo-registry` | `/home/dev/.cargo/registry` | Cargo registry cache | | `${devcontainerId}-rustup-cargo-git` | `/home/dev/.cargo/git` | Cargo's cache of git-sourced dependencies | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | Only `registry/` and `git/` are mounted; `~/.cargo/bin` is intentionally left in the image layer so the toolchain binaries always come from the image. +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. + ## Editor Integration - Installs the `rust-lang.rust-analyzer` VS Code extension, with format-on-save enabled for Rust files. diff --git a/src/rustup/devcontainer-template.json b/src/rustup/devcontainer-template.json index 98df778..8c1fed5 100644 --- a/src/rustup/devcontainer-template.json +++ b/src/rustup/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "rustup", - "version": "1.4.3", + "version": "1.5.0", "name": "Rust", "description": "Security-focused Rust dev container with rust-analyzer and persistent Cargo caches.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/temurin/.devcontainer/devcontainer.json b/src/temurin/.devcontainer/devcontainer.json index c48af1c..1ed2e71 100644 --- a/src/temurin/.devcontainer/devcontainer.json +++ b/src/temurin/.devcontainer/devcontainer.json @@ -31,6 +31,12 @@ "source": "${devcontainerId}-temurin-gradle", "target": "/home/dev/.gradle", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/temurin/NOTES.md b/src/temurin/NOTES.md index d231d12..a3b61d3 100644 --- a/src/temurin/NOTES.md +++ b/src/temurin/NOTES.md @@ -47,12 +47,15 @@ One feature release is installed per image tag, so a project that needs a differ ## Persistent Caches -Maven and Gradle keep both their downloaded dependencies and the build tool their wrapper installed under the home directory, so each is persisted whole in a named volume: +Maven and Gradle keep both their downloaded dependencies and the build tool their wrapper installed under the home directory, so each is persisted whole in a named volume. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-temurin-m2` | `/home/dev/.m2` | Maven local repository and the distribution `mvnw` downloads | | `${devcontainerId}-temurin-gradle` | `/home/dev/.gradle` | Gradle dependency and build caches, and the distribution `gradlew` downloads | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/temurin/README.md b/src/temurin/README.md index 760ddc6..2483505 100644 --- a/src/temurin/README.md +++ b/src/temurin/README.md @@ -58,12 +58,15 @@ One feature release is installed per image tag, so a project that needs a differ ## Persistent Caches -Maven and Gradle keep both their downloaded dependencies and the build tool their wrapper installed under the home directory, so each is persisted whole in a named volume: +Maven and Gradle keep both their downloaded dependencies and the build tool their wrapper installed under the home directory, so each is persisted whole in a named volume. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-temurin-m2` | `/home/dev/.m2` | Maven local repository and the distribution `mvnw` downloads | | `${devcontainerId}-temurin-gradle` | `/home/dev/.gradle` | Gradle dependency and build caches, and the distribution `gradlew` downloads | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/temurin/devcontainer-template.json b/src/temurin/devcontainer-template.json index b8376a7..07278a9 100644 --- a/src/temurin/devcontainer-template.json +++ b/src/temurin/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "temurin", - "version": "1.0.0", + "version": "1.1.0", "name": "Java (Temurin)", "description": "Security-focused Java dev container with the Temurin JDK and cached wrapper builds.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/terraform/.devcontainer/devcontainer.json b/src/terraform/.devcontainer/devcontainer.json index d9166ed..70f9c10 100644 --- a/src/terraform/.devcontainer/devcontainer.json +++ b/src/terraform/.devcontainer/devcontainer.json @@ -23,6 +23,12 @@ "source": "${devcontainerId}-terraform-plugin-cache", "target": "/home/dev/.terraform.d/plugin-cache", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/terraform/NOTES.md b/src/terraform/NOTES.md index a7ed9de..8ac04a1 100644 --- a/src/terraform/NOTES.md +++ b/src/terraform/NOTES.md @@ -21,11 +21,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -The Terraform plugin cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading providers: +The Terraform plugin cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading providers. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-terraform-plugin-cache` | `/home/dev/.terraform.d/plugin-cache` | Terraform provider plugin cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/terraform/README.md b/src/terraform/README.md index 9eb08e7..0dbcde9 100644 --- a/src/terraform/README.md +++ b/src/terraform/README.md @@ -32,11 +32,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -The Terraform plugin cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading providers: +The Terraform plugin cache directory is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading providers. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-terraform-plugin-cache` | `/home/dev/.terraform.d/plugin-cache` | Terraform provider plugin cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/terraform/devcontainer-template.json b/src/terraform/devcontainer-template.json index 099d0dc..9b49289 100644 --- a/src/terraform/devcontainer-template.json +++ b/src/terraform/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "terraform", - "version": "1.2.8", + "version": "1.3.0", "name": "Terraform", "description": "Security-focused Terraform dev container with terraform-ls and a plugin cache volume.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/uv/.devcontainer/devcontainer.json b/src/uv/.devcontainer/devcontainer.json index cde6998..1aa94c0 100644 --- a/src/uv/.devcontainer/devcontainer.json +++ b/src/uv/.devcontainer/devcontainer.json @@ -28,6 +28,12 @@ "source": "${devcontainerId}-uv-cache", "target": "/home/dev/.cache/uv", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/uv/NOTES.md b/src/uv/NOTES.md index 59bf6d7..9f6ab30 100644 --- a/src/uv/NOTES.md +++ b/src/uv/NOTES.md @@ -31,14 +31,17 @@ uv sync # install project dependencies ## Persistent Caches -uv's cache is persisted in a named volume, so Python interpreters and packages downloaded by uv survive container rebuilds: +uv's cache is persisted in a named volume, so Python interpreters and packages downloaded by uv survive container rebuilds. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-uv-cache` | `/home/dev/.cache/uv` | uv's cache of downloaded Python interpreters and packages | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | The cache volume and the bind-mounted workspace folder are different filesystems, so uv cannot hardlink packages from the cache into the project's virtual environment. The template sets `UV_LINK_MODE=copy` in `containerEnv` so uv copies them instead of warning `Failed to hardlink files; falling back to full copy` on every install. +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. + ## Editor Integration - Installs the `ms-python.python` and `charliermarsh.ruff` VS Code extensions, with Ruff as the default formatter and fix-all/organize-imports run on save for Python files. diff --git a/src/uv/README.md b/src/uv/README.md index 7a8680e..82f2bd1 100644 --- a/src/uv/README.md +++ b/src/uv/README.md @@ -42,14 +42,17 @@ uv sync # install project dependencies ## Persistent Caches -uv's cache is persisted in a named volume, so Python interpreters and packages downloaded by uv survive container rebuilds: +uv's cache is persisted in a named volume, so Python interpreters and packages downloaded by uv survive container rebuilds. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-uv-cache` | `/home/dev/.cache/uv` | uv's cache of downloaded Python interpreters and packages | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | The cache volume and the bind-mounted workspace folder are different filesystems, so uv cannot hardlink packages from the cache into the project's virtual environment. The template sets `UV_LINK_MODE=copy` in `containerEnv` so uv copies them instead of warning `Failed to hardlink files; falling back to full copy` on every install. +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. + ## Editor Integration - Installs the `ms-python.python` and `charliermarsh.ruff` VS Code extensions, with Ruff as the default formatter and fix-all/organize-imports run on save for Python files. diff --git a/src/uv/devcontainer-template.json b/src/uv/devcontainer-template.json index bcd5e24..4380e81 100644 --- a/src/uv/devcontainer-template.json +++ b/src/uv/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "uv", - "version": "1.0.8", + "version": "1.1.0", "name": "Python (uv)", "description": "Security-focused Python dev container with uv, hardened defaults, and cached packages.", "publisher": "Bare Dev Container Maintainers", diff --git a/src/zig/.devcontainer/devcontainer.json b/src/zig/.devcontainer/devcontainer.json index c64fc94..2450445 100644 --- a/src/zig/.devcontainer/devcontainer.json +++ b/src/zig/.devcontainer/devcontainer.json @@ -25,6 +25,12 @@ "source": "${devcontainerId}-zig-global-cache", "target": "/home/dev/.cache/zig", "type": "volume" + }, + // Persist the shell history the image keeps in this directory. + { + "source": "${devcontainerId}-bash-history", + "target": "/home/dev/.local/state/bash", + "type": "volume" } ], "customizations": { diff --git a/src/zig/NOTES.md b/src/zig/NOTES.md index df89c0a..3baaca8 100644 --- a/src/zig/NOTES.md +++ b/src/zig/NOTES.md @@ -23,11 +23,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -The Zig global cache is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading packages or recompiling dependencies: +The Zig global cache is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading packages or recompiling dependencies. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-zig-global-cache` | `/home/dev/.cache/zig` | Zig global cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/zig/README.md b/src/zig/README.md index a36fca7..01da2df 100644 --- a/src/zig/README.md +++ b/src/zig/README.md @@ -34,11 +34,14 @@ After applying the template, we recommend pinning the image to a digest so every ## Persistent Caches -The Zig global cache is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading packages or recompiling dependencies: +The Zig global cache is persisted in a named volume, so rebuilding the container to pick up image updates doesn't require re-downloading packages or recompiling dependencies. Bash history is persisted the same way, so a rebuild doesn't clear it: | Volume | Mount path | Purpose | |--------|------------|---------| | `${devcontainerId}-zig-global-cache` | `/home/dev/.cache/zig` | Zig global cache | +| `${devcontainerId}-bash-history` | `/home/dev/.local/state/bash` | Bash history file that `HISTFILE` points at | + +The image sets `HISTFILE` to `/home/dev/.local/state/bash/history` rather than the default `~/.bash_history`, so bash writes into the volume. ## Editor Integration diff --git a/src/zig/devcontainer-template.json b/src/zig/devcontainer-template.json index d211d93..a96ec1e 100644 --- a/src/zig/devcontainer-template.json +++ b/src/zig/devcontainer-template.json @@ -1,6 +1,6 @@ { "id": "zig", - "version": "1.3.0", + "version": "1.4.0", "name": "Zig", "description": "Security-focused Zig dev container with zls integration and a persistent build cache.", "publisher": "Bare Dev Container Maintainers", diff --git a/test/_global/common.sh b/test/_global/common.sh index d5b10e3..728b933 100644 --- a/test/_global/common.sh +++ b/test/_global/common.sh @@ -9,6 +9,11 @@ test "$(id -un)" = "dev" test -d "$HOME" test -w "$HOME" +# The image points HISTFILE at a directory it creates; the template mounts a volume there, +# which needs that directory to exist so it belongs to "dev" rather than root. +test "$HISTFILE" = "$HOME/.local/state/bash/history" +test -w "$HOME/.local/state/bash" + # Scratch directory for per-template smoke work. SMOKE_TMP="$(mktemp -d)" trap 'rm -rf "$SMOKE_TMP"' EXIT