-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Implement Dev Containers for All Workshop Repositories
1. Goal & Motivation
To enhance the accessibility and ease of use for all our workshop participants, we aim to implement Dev Containers across all relevant workshop repositories.
This will allow users to quickly spin up a pre-configured, consistent development environment with all necessary tools, dependencies, and VS Code extensions, either through:
- GitHub Codespaces: Cloud-based environment accessible directly from the browser or VS Code.
- Local VS Code with Dev Containers extension: Using Docker on their local machine.
Key Benefits:
- Reduced Setup Friction: Participants can start coding immediately without complex local environment configuration.
- Consistent Environments: Ensures all participants (and instructors) are using the same setup, minimizing "works on my machine" issues.
- Improved Onboarding: Lowers the barrier to entry for workshops, especially those with specific software requirements.
- Reproducibility: Helps ensure that the workshop materials and code behave as expected for everyone.
2. Scope of Work
This initiative applies to all active workshop repositories that involve hands-on coding or require specific software environments. The primary targets are listed in the "Implementation Checklist" below.
3. Core Requirements for Each Dev Container
For each workshop repository, a .devcontainer directory should be created containing at least a devcontainer.json file. This configuration should aim to:
- Specify a Base Image: Use an appropriate base Docker image (e.g., official Python images, mcr.microsoft.com/devcontainers/* images).
- Install Dependencies:
- System-level packages (via
apt-getor similar). - Language-specific dependencies (e.g., Python packages via
requirements.txtorpyproject.toml). - Other necessary tools (e.g.,
git,curl, specific CLIs).
- System-level packages (via
- Configure VS Code:
- Install relevant VS Code extensions (e.g., Python extension, Pylance, Jupyter, Docker extension, linters, formatters).
- Set useful VS Code settings (e.g., default formatter, linter settings).
- Post-Create Commands: Include commands to run after the container is created (e.g.,
pip install -r requirements.txt, initializing a project). - Forward Ports (if applicable): Automatically forward ports required by applications run during the workshop (e.g., web servers, Jupyter).
- User Experience: Ensure the terminal opens in an appropriate directory, and any welcome messages or setup scripts are clear.
4. Key Tasks & General Implementation Plan
- Research & Standardisation (Optional but Recommended):
- Identify common tools, Python versions, and VS Code extensions used across multiple workshops.
- Consider creating a base Dev Container definition or a set of common features/scripts that can be reused or adapted for different workshops to maintain consistency.
- Per-Workshop Implementation (see checklist below):
For each targeted workshop repository:- Analyze Requirements: Identify all software, tools, libraries, and specific versions needed for the workshop. Note any OS-level dependencies.
- Create
devcontainer.json:- Start with a suitable base image. Microsoft provides many pre-built Dev Container images (
mcr.microsoft.com/devcontainers). - Define features to install common tools (e.g., Git, Python, Node).
- List necessary VS Code extensions.
- Configure
postCreateCommandorpostAttachCommandto finalize setup (e.g., install Python packages from arequirements.txtorpyproject.tomlfile).
- Start with a suitable base image. Microsoft provides many pre-built Dev Container images (
- (Optional) Create Custom Dockerfile: If the workshop has complex dependencies not easily handled by features or existing images, create a
Dockerfilein the.devcontainerdirectory and reference it indevcontainer.json. - Testing:
- Thoroughly test the Dev Container by launching it via GitHub Codespaces.
- Test locally using VS Code and the Dev Containers extension.
- Verify that all workshop exercises can be completed within the Dev Container environment.
- Documentation: Add a brief note to the workshop's
README.mdexplaining how to use the Dev Container (e.g., "Click the 'Open in Codespaces' button" or "Open this repository in VS Code with the Dev Containers extension installed").
- Iterate & Refine: Collect feedback and make improvements to the Dev Container configurations as needed.
5. Implementation Checklist / Target Repositories
(This section will be used to track progress across individual workshop repositories. For each repository, you can either just check it off when done, or link to a specific issue created in that repository for its Dev Container implementation.)
-
hands-on-llms(Link to specific issue: Add devcontainer hands-on-llms#7) -
diffusion-models(Link to specific issue: Add devcontainer diffusion-models#10) -
packaging-publishing(Link to specific issue: Add devcontainer packaging-publishing#12)
6. Considerations & Potential Challenges
- Varying Workshop Needs: Different workshops will have different Python versions, libraries, and tools (e.g., Docker-in-Docker for the Docker workshop, GPU access for ML workshops if Codespaces supports it or if targeting local setups). The configurations must be tailored accordingly.
- Image Size & Build Times: Strive for reasonably sized Docker images and efficient build processes for faster Codespaces startup.
- Secrets Management: If workshops require access to secrets or API keys, provide clear instructions on how users should manage these within Codespaces or their local Dev Container (e.g., using Codespaces secrets).
- Maintenance: Dev Container configurations will need to be kept up-to-date as workshop dependencies evolve.
7. Acceptance Criteria (for the overall initiative)
- All repositories listed in the "Implementation Checklist" have a functional Dev Container meeting the per-workshop acceptance criteria.
Per-Workshop Acceptance Criteria (to be met by each item in the checklist):
- A
.devcontainer/devcontainer.json(and potentially aDockerfile) exists in the workshop repository. - The Dev Container successfully builds and launches in GitHub Codespaces.
- The Dev Container successfully builds and launches locally using VS Code with the Dev Containers extension.
- All required software, tools, and VS Code extensions specified for the workshop are present and functional within the container.
- Workshop exercises can be completed within the Dev Container environment without requiring manual installation of core dependencies.
- Basic documentation for using the Dev Container is added to the workshop's
README.md.
8. Resources
- Dev Containers documentation: https://containers.dev/
- GitHub Codespaces documentation: https://docs.github.com/en/codespaces
- VS Code Dev Containers extension: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
- Dev Container features: https://containers.dev/features