Skip to content

righteouslabs/devcontainer-jetify-devbox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev Container Feature: Jetify Devbox

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.

Usage

To use the feature in your devcontainer, add it to your devcontainer.json:

{
    "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
    "features": {
        "ghcr.io/righteouslabs/devcontainer-jetify-devbox/devbox:1": {
            "autoUpdate": true
        }
    }
}

Options

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.

Prerequisites

  • The feature requires the Nix package manager and automatically installs it as a dependency.
  • For automatic updates (autoUpdate: true), a devbox.json file must be present in the root of your repository.

How it works

  1. Installs Devbox using Nix
  2. If autoUpdate is true and a devbox.json file exists in your repository:
    • Changes to the repository root
    • Runs devbox update to initialize the development environment

Repository Structure

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

Development

Testing

The feature includes automated tests that verify the functionality through different scenarios:

Test Structure

  1. Basic Installation Test (test.sh):

    • Verifies devbox is installed and available
    • Checks that basic commands work (e.g., devbox version)
  2. Scenario Tests:

    • test_auto_update_disabled.sh: Tests feature with autoUpdate: false
    • test_auto_update_enabled.sh: Tests feature with autoUpdate: true
    • Both scenarios use Ubuntu-based container image
  3. Test Configuration:

    • Sample devbox.json in test/jetify-devbox/ with basic packages:
      {
          "packages": [
              "hello",
              "cowsay"
          ]
      }

Running Tests Locally

  1. Install prerequisites:

    # Install the devcontainer CLI
    npm install -g @devcontainers/cli
  2. 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 .

Test Scenarios Configuration

The test scenarios are defined in test/jetify-devbox/scenarios.json

Test Configuration

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.

Publishing

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

Using in GitHub Codespaces

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.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add or update tests as needed
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Dev Container Features Supporting Jetify Devbox

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Shell 100.0%