Skip to content

Conversation

@VAIBHAVSING
Copy link
Owner

Summary

Add intelligent DevContainer base image selection to the agent, completing the migration from custom Docker builds to official Microsoft DevContainer images.

What this adds

Image Selection Logic

  • Automatic language detection from repository metadata
  • Selection of appropriate Microsoft DevContainer base images
  • Integration of Dev8 custom features

Supported Languages

Automatically selects optimal images for:

  • TypeScript/JavaScript (Node.js 20)
  • Python (3.11)
  • Go (1.22)
  • Rust
  • C/C++
  • Java (17)
  • PHP (8.2)
  • Universal (multi-language)

Feature Integration

All workspaces include:

  • Supervisor (monitoring & backups)
  • Claude CLI (AI assistant)
  • AI Tools Bundle (GitHub CLI, Copilot, Azure CLI, etc.)

Architecture

Previous: Custom Docker Build
┌─────────────────────────────┐
│ dev8-ai-tools:latest        │
│ 4 layers, 5-10 min build    │
└─────────────────────────────┘

New: Microsoft Base + Dev8 Features
┌─────────────────────────────┐
│ mcr.microsoft.com/          │ ← Pre-built (0 build time)
│ devcontainers/python:1      │
├─────────────────────────────┤
│ + Dev8 Features:            │ ← Installed at start
│   - supervisor              │
│   - claude-cli              │
│   - ai-tools                │
└─────────────────────────────┘

Benefits

  1. Zero Build Time: Microsoft images are pre-built and cached globally
  2. Faster Deployment: Workspace creation reduced from ~10min to ~2min
  3. Regular Updates: Microsoft maintains base images
  4. Standardization: Consistent base across all workspaces
  5. Flexibility: Features can be modified without rebuilds

Implementation Details

RepoMetadata Analysis

metadata := devcontainer.RepoMetadata{
    Files:        []string{"tsconfig.json", "package.json"},
    PackageFiles: map[string]string{"package.json": "{}"},
    Languages:    map[string]int64{"TypeScript": 10000},
}

Image Selection

selector := devcontainer.NewImageSelector()
spec, _ := selector.SelectImage(ctx, metadata)
// spec.BaseImage = "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye"
// spec.Features = [supervisor, claude-cli, ai-tools]

Testing

Comprehensive test coverage for:

  • Language detection from various file types
  • Base image selection for all supported languages
  • Feature list generation
  • DevContainer JSON generation

Run tests:

cd apps/agent
go test ./internal/devcontainer/...

Part of stacked PRs

This is PR #4 (final) in a stack that implements DevContainer features:

Stack order: This PR is based on feat/devcontainer-ai-tools-bundle

Next Steps

After merging this stack:

  1. Update environment service to use ImageSelector
  2. Add repository analysis to workspace creation flow
  3. Deploy features to GitHub Container Registry
  4. Update deployment strategy to use selected images
  5. Test with real workspaces

Migration Path

The new system maintains backward compatibility:

  • Existing workspaces continue using current images
  • New workspaces automatically use DevContainer images
  • Gradual migration of existing workspaces possible

Add intelligent DevContainer base image selection for the agent.

Implements:
- Automatic language detection from repository metadata
- Selection of official Microsoft DevContainer images
- Integration of Dev8 custom features (supervisor, claude-cli, ai-tools)
- Support for 8+ languages (TypeScript, Python, Go, Rust, etc.)
- Comprehensive test coverage

Migration strategy:
- Replace custom 4-layer Docker builds with pre-built Microsoft images
- Zero build time for base images (pre-built and cached)
- Custom features installed at container start via DevContainer spec
- Maintains all existing Dev8 functionality

Benefits:
- Faster workspace creation (eliminate 5-10 min build time)
- Standardized base images maintained by Microsoft
- Flexibility to add/remove features without rebuilds
- Better compatibility with standard DevContainer tools
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/agent-devcontainer-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant