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

Commit 7d981b9

Browse files
authored
Merge pull request #60 from kmehant/R-devcontainer
Add R devcontainer for statistical computing
2 parents 9150757 + 0ed21d0 commit 7d981b9

File tree

5 files changed

+104
-0
lines changed

5 files changed

+104
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
FROM rocker/r-apt:bionic
7+
8+
# Install git, process tools, lsb-release (common in install instructions for CLIs) and libzip for R Tools extension
9+
RUN apt-get update && apt-get -y install git procps lsb-release libzip-dev
10+
11+
# Register Microsoft key and feed
12+
RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \
13+
dpkg -i packages-microsoft-prod.deb
14+
15+
# Install the .NET Runtime
16+
RUN add-apt-repository universe && \
17+
apt-get install apt-transport-https && \
18+
apt-get update && \
19+
apt-get -y install dotnet-runtime-2.1
20+
21+
# Clean up
22+
RUN apt-get autoremove -y \
23+
&& apt-get clean -y \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# Set the default shell to bash instead of sh
27+
ENV SHELL /bin/bash
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "R",
3+
"dockerFile": "Dockerfile",
4+
"runArgs": [
5+
"--cap-add=SYS_PTRACE",
6+
"--security-opt", "seccomp=unconfined"
7+
],
8+
9+
// Uncomment the next line if you want to publish any ports.
10+
// "appPort": [],
11+
12+
// Uncomment the next line if you want to add in default container specific settings.json values
13+
// "settings": { "workbench.colorTheme": "Quiet Light" },
14+
15+
"postCreateCommand": "R --version",
16+
17+
"extensions": [
18+
"ikuyadeu.r",
19+
"mikhail-arkhipov.r"
20+
]
21+
}

containers/R/.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
README.md
2+
test-project
3+
.vscode
4+
.npmignore

containers/R/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# R
2+
3+
## Summary
4+
5+
*Perform statistical computing using R language on linux. Includes R installed and needed extensions*
6+
7+
| Metadata | Value |
8+
|----------|-------|
9+
| *Contributors* | [Mehant](mailto:[email protected]) |
10+
| *Definition type* | Dockerfile |
11+
| *Languages, platforms* | R |
12+
13+
## Using this definition with an existing folder
14+
15+
This definition does not require any special steps to use. Just follow these steps:
16+
17+
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.
18+
19+
2. To use VS Code's copy of this definition:
20+
1. Start VS Code and open your project folder.
21+
2. Press <kbd>F1</kbd> select and **Remote-Containers: Create Container Configuration File...** from the command palette.
22+
3. Select the R definition.
23+
24+
3. To use latest-and-greatest copy of this definition from the repository:
25+
1. Clone this repository.
26+
2. Copy the contents of `containers/R/.devcontainer` to the root of your project folder.
27+
3. Start VS Code and open your project folder.
28+
29+
4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs.
30+
31+
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
32+
33+
## Testing the definition
34+
35+
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
36+
37+
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.
38+
2. Clone this repository.
39+
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
40+
4. Select the `containers/R` folder.
41+
5. After the folder has opened in the container, you should see the R version printed in the terminal.
42+
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.
43+
44+
## License
45+
46+
Copyright (c) Microsoft Corporation. All rights reserved.
47+
48+
Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE).

containers/R/test-project/sample.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# A sample R script
2+
3+
myString <- "Hello, Remote World!"
4+
print ( myString)

0 commit comments

Comments
 (0)