├── .devcontainer ├── example-rig-rstudio │ └── devcontainer.json ├── template-r-ver │ └── devcontainer.json └── template-r2u │ ├── Dockerfile │ └── devcontainer.json ├── LICENSE ├── README.md └── hello.R /.devcontainer/example-rig-rstudio/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Combination of r-rig and rstudio-server", 3 | "image": "mcr.microsoft.com/devcontainers/base:ubuntu", 4 | "features": { 5 | "ghcr.io/rocker-org/devcontainer-features/r-rig:1": { 6 | "version": "release" 7 | }, 8 | "ghcr.io/rocker-org/devcontainer-features/rstudio-server:0": {} 9 | }, 10 | "postAttachCommand": { 11 | "rstudio-start": "rserver" 12 | }, 13 | "forwardPorts": [ 14 | 8787 15 | ], 16 | "portsAttributes": { 17 | "8787": { 18 | "label": "RStudio IDE" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.devcontainer/template-r-ver/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/rocker-org/devcontainer-templates/tree/main/src/r-ver 3 | { 4 | "name": "R (rocker/r-ver base)", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "image": "ghcr.io/rocker-org/devcontainer/r-ver:4", 7 | 8 | // Features to add to the dev container. More info: https://containers.dev/features. 9 | // "features": {}, 10 | 11 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 12 | // "forwardPorts": [], 13 | 14 | // Use 'postCreateCommand' to run commands after the container is created. 15 | // "postCreateCommand": "R -q -e 'renv::install()'", 16 | 17 | // Configure tool-specific properties. 18 | // "customizations": {}, 19 | 20 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 21 | // "remoteUser": "root" 22 | } 23 | -------------------------------------------------------------------------------- /.devcontainer/template-r2u/Dockerfile: -------------------------------------------------------------------------------- 1 | # r2u only supports amd64 2 | FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/base:jammy 3 | -------------------------------------------------------------------------------- /.devcontainer/template-r2u/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/rocker-org/devcontainer-templates/tree/main/src/r2u 3 | { 4 | "name": "R (r2u and bspm configured)", 5 | "build": { 6 | "dockerfile": "Dockerfile" 7 | }, 8 | 9 | // Features to add to the dev container. More info: https://containers.dev/features. 10 | "features": { 11 | // A Feature to configure R on Ubuntu. More info: https://github.com/rocker-org/devcontainer-features/tree/main/src/r-apt. 12 | "ghcr.io/rocker-org/devcontainer-features/r-apt:0": { 13 | "vscodeRSupport": "full", 14 | "installDevTools": true, 15 | "installRMarkdown": true, 16 | "installRadian": true, 17 | "installVscDebugger": true, 18 | "installBspm": true, 19 | } 20 | }, 21 | 22 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 23 | // "forwardPorts": [], 24 | 25 | // Use 'postCreateCommand' to run commands after the container is created. 26 | // "postCreateCommand": "R -q -e 'install.packages(\"tidyverse\")'", 27 | 28 | // Configure tool-specific properties. 29 | "customizations": { 30 | // Settings for VS Code. 31 | "vscode": { 32 | "extensions": [ 33 | "RDebugger.r-debugger" 34 | ], 35 | "settings": { 36 | "r.rterm.linux": "/usr/local/bin/radian", 37 | "r.bracketedPaste": true, 38 | "r.plot.useHttpgd": true 39 | } 40 | } 41 | }, 42 | 43 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 44 | // "remoteUser": "root" 45 | } 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 eitsupi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Try Out Development Containers: R 2 | 3 | This repository contains some example Dev Container definitions for R and can be run on GitHub Codespaces (click on the badges!). 4 | 5 | ## Dev Container Definitions 6 | 7 | ### [Combination of r-rig and rstudio-server](.devcontainer/example-rig-rstudio) 8 | 9 | [![Open Combination of r-rig and rstudio-server in GitHub Codespaces](https://img.shields.io/badge/Open-example--rig--rstudio-blue?logo=github)](https://codespaces.new/rocker-org/devcontainer-try-r?devcontainer_path=.devcontainer%2Fexample-rig-rstudio%2Fdevcontainer.json) 10 | 11 | It is configured to install [`ghcr.io/rocker-org/devcontainer-features/r-rig`](https://github.com/rocker-org/devcontainer-features/tree/main/src/r-rig) 12 | and [`ghcr.io/rocker-org/devcontainer-features/rstudio-server`](https://github.com/rocker-org/devcontainer-features/tree/main/src/rstudio-server) 13 | on top of [`mcr.microsoft.com/devcontainers/base:ubuntu`](https://github.com/devcontainers/images/tree/main/src/base-ubuntu). 14 | Initially, the latest release version of R is installed, 15 | but [`rig`](https://github.com/r-lib/rig) makes it easy to install a different version of R and switch between these. 16 | 17 | RStudio Server is configured to run immediately after container startup. 18 | 19 | ### [R (rocker/r-ver base) template](.devcontainer/template-r-ver) 20 | 21 | [![Open R (rocker/r-ver base) in GitHub Codespaces](https://img.shields.io/badge/Open-template--r--ver-blue?logo=github)](https://codespaces.new/rocker-org/devcontainer-try-r?devcontainer_path=.devcontainer%2Ftemplate-r-ver%2Fdevcontainer.json) 22 | 23 | A simple template that runs a Docker image [`ghcr.io/rocker-org/devcontainer/r-ver`](https://rocker-project.org/images/devcontainer/images.html) 24 | configured to be used as a Dev Container. 25 | Many R packages are already installed. 26 | 27 | It is just a download of the Dev Container Template 28 | [`ghcr.io/rocker-org/devcontainer-templates/r-ver`](https://github.com/rocker-org/devcontainer-templates/tree/main/src/r-ver). 29 | 30 | ### [R (r2u and bspm configured) template](.devcontainer/template-r2u) 31 | 32 | [![Open R (r2u and bspm configured) in GitHub Codespaces](https://img.shields.io/badge/Open-template--r2u-blue?logo=github)](https://codespaces.new/rocker-org/devcontainer-try-r?devcontainer_path=.devcontainer%2Ftemplate-r2u%2Fdevcontainer.json) 33 | 34 | It is configured to install [`ghcr.io/rocker-org/devcontainer-features/r-apt`](https://github.com/rocker-org/devcontainer-features/tree/main/src/r-apt) 35 | on top of [`mcr.microsoft.com/devcontainers/base:ubuntu`](https://github.com/devcontainers/images/tree/main/src/base-ubuntu). 36 | Installing many R packages quickly thanks to [`r2u`](https://eddelbuettel.github.io/r2u/). 37 | 38 | It is just a download of the Dev Container Template 39 | [`ghcr.io/rocker-org/devcontainer-templates/r2u`](https://github.com/rocker-org/devcontainer-templates/tree/main/src/r2u). 40 | -------------------------------------------------------------------------------- /hello.R: -------------------------------------------------------------------------------- 1 | plot(1, type = "n") 2 | text(x = 1, y = 1, "Hello, world.", cex = 5) 3 | --------------------------------------------------------------------------------