A command-line tool for installing devcontainer features from OCI registries or local directories.
- 🚀 Install features from GitHub Container Registry (ghcr.io)
- 📁 Install features from local directories
- 🔗 Automatic dependency resolution with topological sorting
- ⚙️ Flexible option configuration and merging
- 🧪 Comprehensive test coverage
Download the latest binary from the releases page.
go install github.com/devcontainer-community/feature-installer@latest
git clone https://github.com/devcontainer-community/feature-installer.git
cd feature-installer
make build
# Install a feature from GitHub Container Registry
feature-installer feature install ghcr.io/bascodes/devcontainer-features/debug-dump-env:1
# Install with custom options
feature-installer feature install ghcr.io/example/feature:latest --option key=value
# Install from local directory
feature-installer feature install ./my-feature
# Install with options
feature-installer feature install ./my-feature --option enableFeature=true --option version=1.2.3
The tool automatically resolves dependencies and installs features in the correct order:
feature-installer feature install feature-a feature-b feature-c
- Go 1.23+
- Make (optional, for convenience commands)
# Clone and setup
git clone https://github.com/devcontainer-community/feature-installer.git
cd feature-installer
make deps
# Run tests
make test
# Run all checks (format, vet, test)
make check
# Build
make build
make help # Show all available targets
make build # Build the binary
make test # Run tests
make test-coverage # Run tests with coverage report
make lint # Run linting (requires golangci-lint)
make fmt # Format code
make vet # Run go vet
make check # Run format, vet, and tests
make ci-local # Run CI checks locally
make clean # Clean build artifacts
The feature installer follows this flow:
- Command Parsing: CLI arguments and options are parsed using Cobra
- Feature Detection: Determines if features are OCI references or local directories
- Dependency Resolution: Uses graph-based topological sorting to determine installation order
- OCI Download: Downloads and extracts features from container registries using ORAS
- Installation: Executes
install.sh
scripts with environment variables from user options
cmd/
: CLI command definitions and argument parsinginternal/featureinstaller/
: Core installation logic and dependency resolutioninternal/featureinstaller/oci/
: OCI registry operations and artifact handlinginternal/featureinstaller/directory/
: Local directory feature installationinternal/devcontainer/schemas/
: JSON schema parsing for devcontainer features
The project has comprehensive test coverage including:
- Unit Tests: Test individual components in isolation
- Integration Tests: End-to-end testing with real feature installations
- Test Fixtures: Reusable test features for various scenarios
# Run all tests
go test ./...
# Run with coverage
make test-coverage
# Run specific test package
go test ./internal/featureinstaller/...
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Run tests (
make check
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project uses automated CI checks:
- Go formatting with
gofmt
- Static analysis with
go vet
- Testing with race detection
- Build verification across multiple platforms
- Security scanning with Trivy
All checks must pass before PRs can be merged.
This project is licensed under the MIT License.