From 682e9d9532712bff8f2d35e7db9e6d3878edd696 Mon Sep 17 00:00:00 2001 From: Niall Munro Date: Wed, 24 Sep 2025 23:09:37 +0100 Subject: [PATCH 1/6] Refactor devcontainer setup to use dynamic VSCODE_COMMIT from .env file and update GitHub Actions workflow to read and output commit information --- .devcontainer/devcontainer.json | 2 +- .env | 1 + .github/workflows/build-devcontainer.yml | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .env diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3393cea..c886d92 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "VSCODE_COMMIT": "f220831ea2d946c0dcb0f3eaa480eb435a2c1260" + "VSCODE_COMMIT": "${localEnv:VSCODE_COMMIT}" } }, diff --git a/.env b/.env new file mode 100644 index 0000000..0194890 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VSCODE_COMMIT=f220831ea2d946c0dcb0f3eaa480eb435a2c1260 \ No newline at end of file diff --git a/.github/workflows/build-devcontainer.yml b/.github/workflows/build-devcontainer.yml index 99f11cb..d9102bd 100644 --- a/.github/workflows/build-devcontainer.yml +++ b/.github/workflows/build-devcontainer.yml @@ -12,6 +12,7 @@ on: - main paths: - '.devcontainer/**' + - '.github/workflows/build-devcontainer.yml' workflow_dispatch: env: @@ -31,6 +32,16 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Read VSCODE_COMMIT from .env + id: vscode-commit + run: | + VSCODE_COMMIT=$(grep '^VSCODE_COMMIT=' .devcontainer/.env | cut -d'=' -f2) + VSCODE_SHORT=${VSCODE_COMMIT:0:7} + echo "vscode_commit=$VSCODE_COMMIT" >> $GITHUB_OUTPUT + echo "vscode_short=$VSCODE_SHORT" >> $GITHUB_OUTPUT + echo "Full VSCODE_COMMIT: $VSCODE_COMMIT" + echo "Short VSCODE_COMMIT: $VSCODE_SHORT" + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -52,6 +63,8 @@ jobs: type=ref,event=tag type=sha,prefix={{branch}}-,enable={{is_default_branch}} type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=vscode-${{ steps.vscode-commit.outputs.vscode_short }} + type=raw,value=vscode-${{ steps.vscode-commit.outputs.vscode_short }}-{{sha}} - name: Extract tag names only id: tags @@ -136,6 +149,8 @@ jobs: echo "🏷️ Image: ${{ env.IMAGE_NAME }}" echo "🆔 Tags: ${{ steps.meta.outputs.tags }}" echo "📝 Labels: ${{ steps.meta.outputs.labels }}" + echo "🔧 VSCode Commit: ${{ steps.vscode-commit.outputs.vscode_commit }}" + echo "📋 Short Commit: ${{ steps.vscode-commit.outputs.vscode_short }}" echo "" echo "To use this dev container:" echo "1. Reference it in your devcontainer.json:" From 4d96b4db34cf86790f78a412173f8dd795aaa6e1 Mon Sep 17 00:00:00 2001 From: Niall Munro Date: Wed, 24 Sep 2025 23:35:56 +0100 Subject: [PATCH 2/6] Update devcontainer configuration to remove .env file and read VSCODE_COMMIT directly from devcontainer.json --- .devcontainer/devcontainer.json | 2 +- .env | 1 - .github/workflows/build-devcontainer.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 .env diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c886d92..3393cea 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "VSCODE_COMMIT": "${localEnv:VSCODE_COMMIT}" + "VSCODE_COMMIT": "f220831ea2d946c0dcb0f3eaa480eb435a2c1260" } }, diff --git a/.env b/.env deleted file mode 100644 index 0194890..0000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -VSCODE_COMMIT=f220831ea2d946c0dcb0f3eaa480eb435a2c1260 \ No newline at end of file diff --git a/.github/workflows/build-devcontainer.yml b/.github/workflows/build-devcontainer.yml index d9102bd..0f12121 100644 --- a/.github/workflows/build-devcontainer.yml +++ b/.github/workflows/build-devcontainer.yml @@ -35,7 +35,7 @@ jobs: - name: Read VSCODE_COMMIT from .env id: vscode-commit run: | - VSCODE_COMMIT=$(grep '^VSCODE_COMMIT=' .devcontainer/.env | cut -d'=' -f2) + VSCODE_COMMIT=$(grep 'VSCODE_COMMIT' .devcontainer/devcontainer.json | tr -d '"' | cut -d " " -f 2) VSCODE_SHORT=${VSCODE_COMMIT:0:7} echo "vscode_commit=$VSCODE_COMMIT" >> $GITHUB_OUTPUT echo "vscode_short=$VSCODE_SHORT" >> $GITHUB_OUTPUT From 7e55c4984e55825b7e779a785351d6579083aa16 Mon Sep 17 00:00:00 2001 From: Niall Munro Date: Thu, 25 Sep 2025 00:10:51 +0100 Subject: [PATCH 3/6] Description fix --- .github/workflows/build-devcontainer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-devcontainer.yml b/.github/workflows/build-devcontainer.yml index 0f12121..87ca677 100644 --- a/.github/workflows/build-devcontainer.yml +++ b/.github/workflows/build-devcontainer.yml @@ -32,7 +32,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Read VSCODE_COMMIT from .env + - name: Read VSCODE_COMMIT from devcontainer.json id: vscode-commit run: | VSCODE_COMMIT=$(grep 'VSCODE_COMMIT' .devcontainer/devcontainer.json | tr -d '"' | cut -d " " -f 2) From c3bbc0fb3bbf689052db0686f35cf15cc44cb085 Mon Sep 17 00:00:00 2001 From: Niall Munro Date: Thu, 25 Sep 2025 00:17:31 +0100 Subject: [PATCH 4/6] Update README.md to clarify tagging for VS Code versions and combinations with git commits --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index dc34d35..18e2a7e 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ This dev container is automatically built and published to GitHub Container Regi - `main` - Latest build from main branch - `main-` - Specific commit builds from main branch - `pr-` - Pull request builds for testing + - `vscode-` - Builds with specific VS Code versions + - `vscode--` - Combination of VS Code and git commit **Recommended**: Use `latest` for stable deployments or `main-` for reproducible builds. @@ -94,6 +96,7 @@ The container is built automatically with smart tagging: - **Main Branch Pushes**: Creates `latest`, `main`, and `main-` tags - **Pull Requests**: Creates `pr-` tags for testing +- **VS Code Commits**: Creates `vscode-` and `vscode--` tags - **Manual Dispatch**: Available for on-demand builds - **Platform**: linux/amd64 optimized for development speed @@ -101,3 +104,5 @@ The container is built automatically with smart tagging: - Use `latest` for the most recent stable release - Use `main-` when you need reproducible builds - Use `pr-` tags to test specific pull request changes +- Use `vscode-` tags to match specific VS Code versions +- Use `vscode--` tags for a combination of VS Code and git commits From 7ffc52fe3675be5986d9f6659c5ce27994fdc142 Mon Sep 17 00:00:00 2001 From: Niall Munro Date: Thu, 25 Sep 2025 00:23:26 +0100 Subject: [PATCH 5/6] Add R language support and related features to the dev container --- README.md | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/README.md b/README.md index 18e2a7e..fdfa5cb 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ This includes: - **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) @@ -79,6 +80,93 @@ This includes: - Rainbow CSV - **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](https://github.com/rocker-org/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 + +### R Package Installation Options + +The R feature supports multiple package installation methods: + +1. **Binary Installation via apt** (Fastest) + - Uses pre-compiled packages from CRAN and BioConductor + - On Ubuntu, all CRAN packages available via [r2u](https://eddelbuettel.github.io/r2u/) + - Install using: `apt-get install r-cran-` + +2. **Source Installation via R** + - Traditional `install.packages()` function + - Required for packages not available via apt + +3. **Binary Installation with bspm** (Ubuntu only) + - Bridge to System Package Manager + - Automatically uses apt when available, falls back to source + +### Configuration Example + +To enable R support in your devcontainer, add the r-apt feature to your `devcontainer.json`: + +```json +{ + "name": "Python & R Development Environment", + "build": { + "dockerfile": "Dockerfile" + }, + "features": { + "ghcr.io/rocker-org/devcontainer-features/r-apt:0": { + "vscodeRSupport": "full", + "installDevTools": true, + "installREnv": true, + "installRMarkdown": true, + "installJupyterlab": true, + "installRadian": true, + "installVscDebugger": true + } + } +} +``` + +### Supported Platforms +- `linux/amd64` and `linux/arm64` platforms +- Debian and Ubuntu LTS distributions +- Compatible with non-R base images (R will be installed automatically) + +### Additional R Features + +The Rocker Project provides additional complementary features you can combine: + +- **r-packages**: Install specific R packages via pak during build +- **r-dependent-packages**: Install R packages from a DESCRIPTION file +- **renv-cache**: Share renv cache across containers +- **rstudio-server**: Add RStudio Server for web-based IDE + +Example with additional features: +```json +"features": { + "ghcr.io/rocker-org/devcontainer-features/r-apt:0": { + "vscodeRSupport": "full", + "installDevTools": true, + "installREnv": true + }, + "ghcr.io/rocker-org/devcontainer-features/r-packages:1": { + "packages": "dplyr,ggplot2,tidyr" + }, + "ghcr.io/rocker-org/devcontainer-features/rstudio-server:0": {} +} +``` + +For more detailed information about R devcontainer features, visit the [Rocker Project devcontainer features documentation](https://github.com/rocker-org/devcontainer-features/tree/main/src/r-apt). + ## ⚙️ VS Code Server The container comes with VS Code Server pre-installed for immediate development. For TRE-specific VS Code Server configuration, see the [SDF TRE Setup Guide](SDF_TRE_SETUP.md). From be4f5d8011e7739530b7633d0f49e6ecdb64ff6f Mon Sep 17 00:00:00 2001 From: Niall Munro Date: Thu, 25 Sep 2025 00:23:34 +0100 Subject: [PATCH 6/6] Remove detailed R package installation options and configuration examples from README.md --- README.md | 72 ------------------------------------------------------- 1 file changed, 72 deletions(-) diff --git a/README.md b/README.md index fdfa5cb..ad06e5c 100644 --- a/README.md +++ b/README.md @@ -95,78 +95,6 @@ This dev container includes comprehensive R language support through the [Rocker - **Interactive Console**: radian (enhanced R console with syntax highlighting) - **Debugging Support**: vscDebugger package for VS Code R debugging -### R Package Installation Options - -The R feature supports multiple package installation methods: - -1. **Binary Installation via apt** (Fastest) - - Uses pre-compiled packages from CRAN and BioConductor - - On Ubuntu, all CRAN packages available via [r2u](https://eddelbuettel.github.io/r2u/) - - Install using: `apt-get install r-cran-` - -2. **Source Installation via R** - - Traditional `install.packages()` function - - Required for packages not available via apt - -3. **Binary Installation with bspm** (Ubuntu only) - - Bridge to System Package Manager - - Automatically uses apt when available, falls back to source - -### Configuration Example - -To enable R support in your devcontainer, add the r-apt feature to your `devcontainer.json`: - -```json -{ - "name": "Python & R Development Environment", - "build": { - "dockerfile": "Dockerfile" - }, - "features": { - "ghcr.io/rocker-org/devcontainer-features/r-apt:0": { - "vscodeRSupport": "full", - "installDevTools": true, - "installREnv": true, - "installRMarkdown": true, - "installJupyterlab": true, - "installRadian": true, - "installVscDebugger": true - } - } -} -``` - -### Supported Platforms -- `linux/amd64` and `linux/arm64` platforms -- Debian and Ubuntu LTS distributions -- Compatible with non-R base images (R will be installed automatically) - -### Additional R Features - -The Rocker Project provides additional complementary features you can combine: - -- **r-packages**: Install specific R packages via pak during build -- **r-dependent-packages**: Install R packages from a DESCRIPTION file -- **renv-cache**: Share renv cache across containers -- **rstudio-server**: Add RStudio Server for web-based IDE - -Example with additional features: -```json -"features": { - "ghcr.io/rocker-org/devcontainer-features/r-apt:0": { - "vscodeRSupport": "full", - "installDevTools": true, - "installREnv": true - }, - "ghcr.io/rocker-org/devcontainer-features/r-packages:1": { - "packages": "dplyr,ggplot2,tidyr" - }, - "ghcr.io/rocker-org/devcontainer-features/rstudio-server:0": {} -} -``` - -For more detailed information about R devcontainer features, visit the [Rocker Project devcontainer features documentation](https://github.com/rocker-org/devcontainer-features/tree/main/src/r-apt). - ## ⚙️ VS Code Server The container comes with VS Code Server pre-installed for immediate development. For TRE-specific VS Code Server configuration, see the [SDF TRE Setup Guide](SDF_TRE_SETUP.md).