Skip to content

smartdatafoundry/devcontainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devcontainer logo

devcontainer

Development container focused on Python (with first-class R support) providing a reproducible, batteries‑included environment. It ships with the VS Code Dev Containers extension assets, curated tooling, and a consistent tagging strategy for deterministic rebuilds.

Table of Contents

  1. Published Container
  2. Quick Start
  3. Using in SDF TRE
  4. Documentation
  5. What's Included
  6. R Language Support
  7. VS Code Server
  8. Adding Extensions
  9. Automated Builds & Tag Strategy
  10. Contributing
  11. License

Build and Publish Dev Container

📦 Published Container

Built and published automatically to GitHub Container Registry (GHCR):

  • Registry: ghcr.io
  • Image: ghcr.io/smartdatafoundry/devcontainer
  • Tag Families:
    • latest – Most recent stable main build
    • main – Moving pointer to HEAD of main
    • main-<branch-sha> – Immutable build for a specific main commit
    • pr-<number> – Ephemeral preview for a pull request
    • vscode-<vscode-sha> – Locks VS Code Server version (container content may still move)
    • vscode-<vscode-sha>-<branch-sha> – Fully reproducible (VS Code Server + container commit)

Recommended:

  • Daily development: latest
  • CI / Reproducibility: vscode-<vscode-sha>-<branch-sha>
  • VS Code Server pin only: vscode-<vscode-sha>

🚀 Quick Start

Using the Published Container

Add this to your .devcontainer/devcontainer.json:

{
  "name": "Python Development",
  "image": "ghcr.io/smartdatafoundry/devcontainer:latest"
}

Using in SDF Trusted Research Environment

Quick Setup with Included Scripts (Recommended)

The devcontainer includes setup scripts for easy deployment in the SDF TRE:

# 1. Pull the container image
ces-pull a a ghcr.io/smartdatafoundry/devcontainer:latest

# 2. Extract the setup scripts
podman run --rm -v $HOME:$HOME -w $HOME \
  ghcr.io/smartdatafoundry/devcontainer:latest \
  cp -r /opt/devcontainerctl $HOME/devcontainerctl

# 3. Run the setup script (one-time setup)
cd $HOME/devcontainerctl
./setup.sh

# 4. Start your devcontainer
devcontainerctl start

The setup script will:

  • Create a symlink to devcontainerctl in ~/bin
  • Add ~/bin to your PATH
  • Configure a daily cron job (8:00 AM) to update your container with the latest version

Available devcontainerctl commands:

  • devcontainerctl start - Start container with existing image
  • devcontainerctl stop - Stop the container
  • devcontainerctl restart - Restart the container
  • devcontainerctl status - Check container status
  • devcontainerctl sync - Update the container image
  • devcontainerctl update - Update and restart with new image
  • devcontainerctl remove - Stop and remove the container

Manual Setup

For detailed manual setup instructions, see the SDF TRE Setup Guide.

Using This Repository Directly

  1. Clone this repository
  2. Open in VS Code
  3. Select "Reopen in Container" when prompted

📚 Documentation

Topic Reference
SDF TRE usage docs/SDF_TRE_SETUP.md
Full container internals docs/DEVCONTAINER.md
Setup scripts devcontainerctl/ directory
Reusable publish workflow docs/BUILD_PUBLISH_CONTAINER.md
Dev Container Specification https://containers.dev

🛠️ What's Included

  • Base: Ubuntu 24.04 (Noble) via Microsoft's devcontainers base image
  • Python: System Python with development tools (via devcontainer feature)
  • R: Full R language support with development tools (via Rocker Project devcontainer feature)
  • Git: Latest version with configuration support
  • Shell: Zsh with Oh My Zsh (via common-utils feature)
  • Quarto: Document publishing platform (latest version)
  • Marimo: Markdown presentation tool, alternative to Jupyter Notebooks
  • User Setup Scripts: Automated deployment and management tools (devcontainerctl/)
  • VS Code Extensions (curated):
  • VS Code Server: Pre-installed for immediate development

📊 R Language Support

This dev container includes comprehensive R language support through the Rocker Project's devcontainer features. The R feature provides:

Features Available

  • R Installation: Latest R version via apt package manager
  • Development Tools: devtools, renv for package management
  • IDE Integration:
    • languageserver package for VS Code R extension support
    • httpgd package for interactive graphics
    • rmarkdown for document generation
  • Jupyter Integration: R kernel for Jupyter notebooks
  • Interactive Console: radian (enhanced R console with syntax highlighting)
  • Debugging Support: vscDebugger package for VS Code R debugging

⚙️ VS Code Server

Pre-installed. Pin a version using the tag families described above or via build arg VSCODE_COMMIT (default: 7d842fb85a0275a4a8e4d7e040d2625abbf7f084). For environment-specific considerations (e.g. TRE) see docs/SDF_TRE_SETUP.md.

Adding New Extensions

To add new VS Code extensions to the container, follow these steps:

  1. Open the appropriate file in .devcontainer/vscode-init/:
  2. Add the identifier of the desired extension in the format publisher.extensionName on a new line.
  3. Save the changes to the extension file.
  4. Commit and push the changes to your repository to trigger the build workflow with the updated extensions

🔄 Automated Builds & Tag Strategy

Build Workflow

Workflow: .github/workflows/build-devcontainer.yml

Triggers:

  • Pull Requests touching devcontainer/workflow files → build + pr-<number> tag
  • Manual dispatch (with required vscode_commit input) → publish full tag set

Outputs per production run:

  • latest, main, main-<branch-sha>
  • vscode-<vscode-sha>, vscode-<vscode-sha>-<branch-sha>

Manual build steps:

  1. Open Actions → Build and Publish Dev Container
  2. Run workflow, supplying VS Code Server commit hash
  3. Await completion & verify tags on GHCR package page

Tag usage quick reference:

Need Tag
Stable rolling latest
Immutable main snapshot main-<sha>
Test PR pr-<number>
Pin VS Code Server only vscode-<vscode-sha>
Full reproducibility vscode-<vscode-sha>-<sha>

Reusable generic Docker workflow documentation: see docs/BUILD_PUBLISH_CONTAINER.md.

VS Code Auto-Update Workflow

Update VS Code Version

Workflow: .github/workflows/update-vscode.yml

An automated workflow that:

  • Runs daily at 2:00 AM UTC to check for new VS Code releases
  • Compares the latest stable VS Code commit hash with the current version in the Dockerfile
  • Automatically creates a PR when a new version is available
  • Enables auto-merge to update the container once all checks pass

This ensures the devcontainer stays up-to-date with the latest VS Code releases without manual intervention.

For detailed configuration and usage information, see docs/VSCODE_AUTO_UPDATE.md.


🤝 Contributing & License

Contribution workflow is standard GitHub Flow. See section above plus open issues for opportunities.

License: MIT


About

Base Dev Container development environment for working with Python

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors