Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 16, 2025

Overview

This PR adds full GitHub Codespaces support to the .NET AI Workshop, enabling users to run the entire lab without any local installation. This addresses users who can't install Docker, face corporate firewall restrictions, or simply want to get started immediately.

What's New

🚀 GitHub Codespaces Integration

Users can now click the "Open in GitHub Codespaces" badge and have a fully configured development environment ready in 3-5 minutes. No need to install:

  • .NET 9.0 SDK
  • Docker Desktop
  • Visual Studio or VS Code
  • Azure CLI or other tools

📦 Pre-Configured Starting Solution

A ready-to-run starting solution is available in src/start/GenAiLab/ that mirrors the Part 2 project. Users can:

  • Skip the project creation steps
  • Start directly with AI provider configuration
  • Follow along with the workshop from Part 2 onward

This is especially valuable for workshop attendees who encounter setup issues or time constraints.

🎨 Two Configuration Options

Standard Configuration (.devcontainer/devcontainer.json)

  • GitHub Models or Azure OpenAI integration
  • Docker-in-Docker for Qdrant vector database
  • Best for most users following the standard workshop path

Ollama Configuration (.devcontainer/Ollama/devcontainer.json)

  • All standard features plus Ollama for local AI models
  • Pre-pulled models: llama3.2, phi4-mini, all-minilm
  • Supports completely offline development
  • Great for users who hit API rate limits or prefer local models

Key Features

  • Automatic Setup: Packages restore automatically on Codespace creation
  • Auto-Open Solution: Starting solution opens automatically in VS Code
  • Port Forwarding: Aspire dashboard (17057) and Ollama API (11434) automatically forwarded
  • Comprehensive Documentation: Dedicated guides for Codespaces users
  • CI/CD Integration: GitHub Actions now builds the starting solution to ensure it stays in sync
  • Backward Compatible: Legacy devcontainer location preserved for local VS Code dev containers

Documentation Updates

  • Main README: Added prominent Codespaces badge and quick start section
  • Part 1 Setup: Highlighted Codespaces as a zero-installation alternative
  • Part 2 Creation: Referenced pre-loaded starting solution for Codespaces users
  • CODESPACES.md: New comprehensive quick start guide
  • .devcontainer/README.md: Detailed Codespaces documentation and troubleshooting
  • src/start/README.md: Explains the starting solution and when to use it

Implementation Details

The implementation follows Microsoft Learn's .NET Aspire Dev Containers guidance, placing devcontainer configurations in the repository root (.devcontainer/) as required by GitHub Codespaces.

Build Verification

All solutions build successfully:

  • ✅ Part 2 - Project Creation
  • ✅ Part 6 - Deployment
  • ✅ Part 7 - MCP Server Basics
  • ✅ Part 8 - Enhanced MCP Server
  • src/start/GenAiLab (new)

Files Changed

  • 75 files changed, 19,874 insertions(+), 5 deletions(-)
  • New directories: .devcontainer/, src/start/

Benefits

  • 🚀 Fast Setup: 3-5 minutes vs 20-30 minutes local installation
  • 🌐 Universal Access: Works on any device with a browser
  • 🔒 Corporate-Friendly: Works behind firewalls and with security policies
  • 📊 Consistent Environment: Everyone gets identical development setup
  • 🎯 Accessibility: Perfect for workshops, classrooms, and remote learning

Testing

Manual testing in an actual GitHub Codespaces environment is recommended to validate:

  • Codespace creation and initialization
  • Automatic package restoration
  • Solution opening behavior
  • Port forwarding functionality
  • Both Standard and Ollama configurations

This enhancement makes the workshop significantly more accessible while maintaining full compatibility with local development workflows.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for running the lab in GitHub Codespace</issue_title>
<issue_description>The lab should be able to run in GitHub Codespace. Use the documentation in https://learn.microsoft.com/en-us/dotnet/aspire/get-started/dev-containers. I believe we should have a starting solution folder that runs in Codespace and the users will be able to follow the steps in the lab for cases where they can't install Docker or have other setup issues.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #209


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@jongalloway jongalloway marked this pull request as ready for review October 16, 2025 11:54
@jongalloway jongalloway requested a review from Copilot October 16, 2025 11:54
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive GitHub Codespaces support to the .NET AI Workshop, enabling users to run the entire lab in the cloud without local Docker or .NET SDK installation. The changes include moving devcontainer configurations to .devcontainer/ for Codespaces compatibility, creating a pre-configured starting solution in src/start/, updating documentation to highlight the Codespaces option, and integrating the starting solution into the CI/CD pipeline.

Key Changes:

  • Relocated devcontainer configurations from .github/.devcontainer/ to .devcontainer/ for GitHub Codespaces support
  • Added a complete starting solution (src/start/GenAiLab/) that mirrors the Part 2 project structure
  • Updated all workshop documentation to reference Codespaces as a quick-start option
  • Integrated starting solution into GitHub Actions CI workflow

Reviewed Changes

Copilot reviewed 64 out of 75 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.devcontainer/devcontainer.json Standard Codespaces configuration with .NET 9.0, Docker-in-Docker, and Azure CLI
.devcontainer/Ollama/devcontainer.json Alternative Codespaces configuration with local Ollama AI models
.devcontainer/README.md Comprehensive Codespaces setup and usage documentation
src/start/README.md Documentation for the pre-configured starting solution
src/start/GenAiLab/ Complete starting solution mirroring Part 2 project structure
CODESPACES.md Quick start guide for Codespaces users
README.md Updated main README with Codespaces quick start section
Part 1 - Setup/README.md Added Codespaces as primary setup option
Part 2 - Project Creation/README.md Updated to allow skipping project creation when using Codespaces
.github/workflows/dotnet-build.yml Added CI validation for starting solution
.github/.devcontainer/README.md Added location notice pointing to new devcontainer path

https://github.com/markedjs/marked
License: MIT

To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked.
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'with' (duplicate word removed).

Suggested change
To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked.
To update, replace the `dist/marked.esm.js` file with an updated version from https://www.npmjs.com/package/marked.

Copilot uses AI. Check for mistakes.

Comment on lines +38 to +39
"postCreateCommand": "sudo dotnet workload update && dotnet new install Microsoft.Extensions.AI.Templates && cd src/start/GenAiLab && dotnet restore",
"postStartCommand": "",
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The postCreateCommand chains multiple operations with &&. If any intermediate command fails, subsequent commands won't execute, but the container will still be created. Consider using postCreateCommand for critical setup only and moving optional operations to postStartCommand or using ; instead of && to ensure container creation succeeds even if non-critical commands fail.

Suggested change
"postCreateCommand": "sudo dotnet workload update && dotnet new install Microsoft.Extensions.AI.Templates && cd src/start/GenAiLab && dotnet restore",
"postStartCommand": "",
"postCreateCommand": "sudo dotnet workload update && dotnet new install Microsoft.Extensions.AI.Templates",
"postStartCommand": "cd src/start/GenAiLab && dotnet restore",

Copilot uses AI. Check for mistakes.

Comment on lines +44 to +45
"postCreateCommand": "sudo dotnet workload update && dotnet new install Microsoft.Extensions.AI.Templates && ollama pull all-minilm && ollama pull llama3.2 && ollama pull phi4-mini && cd src/start/GenAiLab && dotnet restore",
"postStartCommand": "",
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The postCreateCommand chains multiple operations with &&. If any intermediate command fails (e.g., ollama pull due to network issues), subsequent commands won't execute, but the container will still be created. Consider using postCreateCommand for critical setup only and moving optional operations to postStartCommand or using ; instead of && to ensure container creation succeeds even if non-critical commands fail.

Suggested change
"postCreateCommand": "sudo dotnet workload update && dotnet new install Microsoft.Extensions.AI.Templates && ollama pull all-minilm && ollama pull llama3.2 && ollama pull phi4-mini && cd src/start/GenAiLab && dotnet restore",
"postStartCommand": "",
"postCreateCommand": "sudo dotnet workload update && dotnet new install Microsoft.Extensions.AI.Templates && cd src/start/GenAiLab && dotnet restore",
"postStartCommand": "ollama pull all-minilm; ollama pull llama3.2; ollama pull phi4-mini",

Copilot uses AI. Check for mistakes.

@Copilot Copilot AI changed the title [WIP] Add support for running the lab in GitHub Codespace Add GitHub Codespaces support with pre-configured starting solution Oct 16, 2025
@Copilot Copilot AI requested a review from jongalloway October 16, 2025 11:58
Copilot finished work on behalf of jongalloway October 16, 2025 11:58
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.

Add support for running the lab in GitHub Codespace

2 participants