This repository provides a Dev Container Feature that installs Devbox in your development container. Devbox is a command-line tool that lets you create isolated shells for development.
To use the feature in your devcontainer, add it to your devcontainer.json:
| Option | Type | Default | Description |
|---|---|---|---|
| autoUpdate | boolean | true | Automatically run 'devbox update' after container creation. This relies on 'devbox.json' file being present in the root of the repository. |
- The feature requires the Nix package manager and automatically installs it as a dependency.
- For automatic updates (
autoUpdate: true), adevbox.jsonfile must be present in the root of your repository.
- Installs Devbox using Nix
- If
autoUpdateis true and adevbox.jsonfile exists in your repository:- Changes to the repository root
- Runs
devbox updateto initialize the development environment
This repository follows the standard dev container Feature structure:
.
├── src
│ └── jetify-devbox
│ ├── devcontainer-feature.json # Feature metadata and options
│ └── install.sh # Installation script
└── test
└── jetify-devbox # Feature-specific tests
├── scenarios.json # Test scenarios
└── test.sh # Test script
The feature includes automated tests that verify the functionality through different scenarios:
-
Basic Installation Test (
test.sh):- Verifies devbox is installed and available
- Checks that basic commands work (e.g.,
devbox version)
-
Scenario Tests:
test_auto_update_disabled.sh: Tests feature withautoUpdate: falsetest_auto_update_enabled.sh: Tests feature withautoUpdate: true- Both scenarios use Ubuntu-based container image
-
Test Configuration:
- Sample
devbox.jsonintest/jetify-devbox/with basic packages:{ "packages": [ "hello", "cowsay" ] }
- Sample
-
Install prerequisites:
# Install the devcontainer CLI npm install -g @devcontainers/cli -
Run the tests:
# Test all features devcontainer features test . # Test only your jetify-devbox feature devcontainer features test -f jetify-devbox . # Test with specific base image devcontainer features test -f jetify-devbox --base-image ubuntu:focal . # Run only scenario tests devcontainer features test --skip-autogenerated . # Run only global scenarios devcontainer features test --global-scenarios-only .
The test scenarios are defined in test/jetify-devbox/scenarios.json
The test suite uses a sample devbox.json in the test/jetify-devbox directory:
{
"packages": [
"hello",
"cowsay"
]
}This configuration is used to verify initialization behavior and package installation.
This feature is published to GitHub Container Registry (GHCR) and follows semantic versioning. You can find the latest version at:
ghcr.io/righteouslabs/devcontainer-jetify-devbox/devbox:1
The feature is publicly available and can be used directly in GitHub Codespaces without any additional configuration. Simply add it to your devcontainer.json as shown in the Usage section above.
- Fork the repository
- Create a feature branch
- Make your changes
- Add or update tests as needed
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
{ "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { "ghcr.io/righteouslabs/devcontainer-jetify-devbox/devbox:1": { "autoUpdate": true } } }