Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Add R devcontainer for statistical computing #60

Merged
merged 4 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions containers/R/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM rocker/r-apt:bionic

# Install git, process tools, lsb-release (common in install instructions for CLIs) and libzip for R Tools extension
RUN apt-get update && apt-get -y install git procps lsb-release libzip-dev

# Register Microsoft key and feed
RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb

# Install the .NET Runtime
RUN add-apt-repository universe && \
apt-get install apt-transport-https && \
apt-get update && \
apt-get -y install dotnet-runtime-2.1

# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Set the default shell to bash instead of sh
ENV SHELL /bin/bash
21 changes: 21 additions & 0 deletions containers/R/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "R",
"dockerFile": "Dockerfile",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt", "seccomp=unconfined"
],

// Uncomment the next line if you want to publish any ports.
// "appPort": [],

// Uncomment the next line if you want to add in default container specific settings.json values
// "settings": { "workbench.colorTheme": "Quiet Light" },

"postCreateCommand": "R --version",

"extensions": [
"ikuyadeu.r",
"mikhail-arkhipov.r"
]
}
4 changes: 4 additions & 0 deletions containers/R/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
README.md
test-project
.vscode
.npmignore
48 changes: 48 additions & 0 deletions containers/R/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# R

## Summary

*Perform statistical computing using R language on linux. Includes R installed and needed extensions*

| Metadata | Value |
|----------|-------|
| *Contributors* | [Mehant](mailto:kmehant@gmail.com) |
| *Definition type* | Dockerfile |
| *Languages, platforms* | R |

## Using this definition with an existing folder

This definition does not require any special steps to use. Just follow these steps:

1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.

2. To use VS Code's copy of this definition:
1. Start VS Code and open your project folder.
2. Press <kbd>F1</kbd> select and **Remote-Containers: Create Container Configuration File...** from the command palette.
3. Select the R definition.

3. To use latest-and-greatest copy of this definition from the repository:
1. Clone this repository.
2. Copy the contents of `containers/R/.devcontainer` to the root of your project folder.
3. Start VS Code and open your project folder.

4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs.

5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.

## Testing the definition

This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:

1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
2. Clone this repository.
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
4. Select the `containers/R` folder.
5. After the folder has opened in the container, you should see the R version printed in the terminal.
6. Now open the `test-project/sample.R` and press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd> for Windows users and Change <kbd>Ctrl</kbd> to <kbd>command</kbd> for Mac users to run the script.

## License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE).
4 changes: 4 additions & 0 deletions containers/R/test-project/sample.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# A sample R script

myString <- "Hello, Remote World!"
print ( myString)