|
| 1 | +# Development Container |
| 2 | + |
| 3 | +This directory contains development container configurations for a consistent development experience. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +### Option 1: VS Code Dev Containers (Recommended) |
| 8 | +1. Install [VS Code](https://code.visualstudio.com/) and the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) |
| 9 | +2. Clone this repository |
| 10 | +3. Open in VS Code |
| 11 | +4. Click "Reopen in Container" when prompted (or use Command Palette: "Dev Containers: Reopen in Container") |
| 12 | + |
| 13 | +### Option 2: GitHub Codespaces |
| 14 | +1. Go to the repository on GitHub |
| 15 | +2. Click the green "Code" button |
| 16 | +3. Select "Codespaces" tab |
| 17 | +4. Click "Create codespace on main" |
| 18 | + |
| 19 | +## Configuration Files |
| 20 | + |
| 21 | +### `devcontainer.json` (Default) |
| 22 | +- **Use Case**: Standard development with full tooling |
| 23 | +- **Features**: |
| 24 | + - .NET 9 SDK |
| 25 | + - Docker-in-Docker support |
| 26 | + - GitHub CLI |
| 27 | + - PowerShell |
| 28 | + - Pre-configured VS Code extensions |
| 29 | + - Development tools (ReportGenerator, dotnet-outdated) |
| 30 | + |
| 31 | +### `devcontainer-simple.json` (Alternative) |
| 32 | +- **Use Case**: Multi-container setup with Redis |
| 33 | +- **Features**: |
| 34 | + - Application container with .NET 9 |
| 35 | + - Redis container for caching tests |
| 36 | + - Docker Compose orchestration |
| 37 | + - Minimal VS Code configuration |
| 38 | + |
| 39 | +## What's Included |
| 40 | + |
| 41 | +### Pre-installed Tools |
| 42 | +- ✅ .NET 9 SDK |
| 43 | +- ✅ Docker CLI |
| 44 | +- ✅ GitHub CLI |
| 45 | + |
| 46 | +### VS Code Extensions |
| 47 | +- ✅ C# Dev Kit |
| 48 | +- ✅ EditorConfig support |
| 49 | +- ✅ Docker extension |
| 50 | +- ✅ GitHub Actions extension |
| 51 | +- ✅ Spell checker |
| 52 | + |
| 53 | +### Port Forwarding |
| 54 | +- **8080**: MCP Server (main application) |
| 55 | +- **5000**: HTTP development server |
| 56 | +- **5001**: HTTPS development server |
| 57 | +- **6379**: Redis (when using docker-compose setup) |
| 58 | + |
| 59 | +## Environment Variables |
| 60 | + |
| 61 | +The container sets these environment variables: |
| 62 | +- `DOTNET_CLI_TELEMETRY_OPTOUT=1` - Disable .NET telemetry |
| 63 | +- `DOTNET_NOLOGO=1` - Hide .NET startup messages |
| 64 | +- `ASPNETCORE_ENVIRONMENT=Development` - Set development mode |
| 65 | + |
| 66 | +## Volume Mounts |
| 67 | + |
| 68 | +- **NuGet Cache**: Persistent volume for faster package restoration |
| 69 | +- **Source Code**: Workspace mounted for live editing |
| 70 | + |
| 71 | +## Usage |
| 72 | + |
| 73 | +### Running the Application |
| 74 | +```bash |
| 75 | +# Build and run |
| 76 | +dotnet run --project src/AzureDevOps.MCP |
| 77 | + |
| 78 | +# Run with specific configuration |
| 79 | +dotnet run --project src/AzureDevOps.MCP --configuration Debug |
| 80 | +``` |
| 81 | + |
| 82 | +### Running Tests |
| 83 | +```bash |
| 84 | +# Run all tests |
| 85 | +dotnet test |
| 86 | + |
| 87 | +# Run with detailed output |
| 88 | +dotnet test --verbosity normal |
| 89 | + |
| 90 | +# Run specific test categories |
| 91 | +dotnet test --filter Category=Unit |
| 92 | +dotnet test --filter Category=Integration |
| 93 | + |
| 94 | +# Test coverage is handled by CI/CD |
| 95 | +``` |
| 96 | + |
| 97 | +### Docker Commands |
| 98 | +```bash |
| 99 | +# Build Docker image |
| 100 | +docker build -t azuredevops-mcp . |
| 101 | + |
| 102 | +# Run with docker-compose |
| 103 | +docker-compose -f docker-compose.dev.yml up |
| 104 | +``` |
| 105 | + |
| 106 | +## Configuration |
| 107 | + |
| 108 | +### Azure DevOps Setup |
| 109 | +1. Copy `.env.example` to `.env.development` |
| 110 | +2. Update with your Azure DevOps details: |
| 111 | + ```bash |
| 112 | + AZDO_ORGANIZATIONURL=https://dev.azure.com/your-organization |
| 113 | + AZDO_PERSONALACCESSTOKEN=your-pat-token |
| 114 | + ``` |
| 115 | + |
| 116 | +### Using with GitHub Codespaces |
| 117 | +The configuration is optimized for GitHub Codespaces with: |
| 118 | +- Automatic port forwarding |
| 119 | +- Pre-built development environment |
| 120 | +- Integrated GitHub CLI for repository operations |
| 121 | + |
| 122 | +## Troubleshooting |
| 123 | + |
| 124 | +### Container Won't Start |
| 125 | +1. **Ensure Docker is running** |
| 126 | + - Windows: Check Docker Desktop is running |
| 127 | + - macOS: Check Docker Desktop is running |
| 128 | + - Linux: Check `docker` service is active |
| 129 | + |
| 130 | +2. **Check Docker resources** |
| 131 | + - Allocate at least 4GB RAM to Docker |
| 132 | + - Ensure sufficient disk space (2GB+ free) |
| 133 | + |
| 134 | +3. **Try alternative configurations** |
| 135 | + - Use `devcontainer-minimal.json` for basic setup |
| 136 | + - Use `devcontainer-simple.json` for docker-compose setup |
| 137 | + |
| 138 | +4. **Rebuild container** |
| 139 | + - Command Palette: "Dev Containers: Rebuild Container" |
| 140 | + - Or: "Dev Containers: Rebuild and Reopen in Container" |
| 141 | + |
| 142 | +### Common Issues |
| 143 | + |
| 144 | +**Error: "Command failed"** |
| 145 | +- Try the minimal configuration first |
| 146 | +- Check Docker Desktop is not updating |
| 147 | +- Restart Docker Desktop and VS Code |
| 148 | + |
| 149 | +**Permission Issues** |
| 150 | +- Ensure your user has Docker permissions |
| 151 | +- On Linux: Add user to `docker` group |
| 152 | + |
| 153 | +**Slow Performance** |
| 154 | +- Increase Docker Desktop memory (8GB+ recommended) |
| 155 | +- Close other Docker containers |
| 156 | +- Use SSD storage for Docker |
| 157 | + |
| 158 | +**Extension Issues** |
| 159 | +- Start with minimal extensions first |
| 160 | +- Install additional extensions after container starts |
| 161 | +- Some extensions require container restart |
| 162 | + |
| 163 | +### Build Issues Resolved |
| 164 | + |
| 165 | +The previous build issues with package version conflicts have been resolved: |
| 166 | +- ✅ Fixed Microsoft.CodeAnalysis package version conflicts |
| 167 | +- ✅ Corrected Sentry performance service implementation |
| 168 | +- ✅ Updated cache statistics method calls |
| 169 | +- ✅ Simplified devcontainer setup process |
| 170 | + |
| 171 | +### Getting Help |
| 172 | +If devcontainers don't work for you: |
| 173 | +- Manual setup: `dotnet restore && dotnet build && dotnet test` |
| 174 | +- Create an issue with your Docker/VS Code versions |
| 175 | +- All known dependency conflicts have been resolved |
| 176 | + |
| 177 | +## Customization |
| 178 | + |
| 179 | +### Adding Extensions |
| 180 | +Edit `.devcontainer/devcontainer.json`: |
| 181 | +```json |
| 182 | +"extensions": [ |
| 183 | + "ms-dotnettools.csharp", |
| 184 | + "your-extension-id" |
| 185 | +] |
| 186 | +``` |
| 187 | + |
| 188 | +### Adding Tools |
| 189 | +Edit `.devcontainer/Dockerfile` or `onCreateCommand` in `devcontainer.json` |
| 190 | + |
| 191 | +### Environment Variables |
| 192 | +Add to `remoteEnv` in `devcontainer.json`: |
| 193 | +```json |
| 194 | +"remoteEnv": { |
| 195 | + "YOUR_VARIABLE": "value" |
| 196 | +} |
| 197 | +``` |
0 commit comments