From 9910562a0290a28a41cc580f8f3ebfc8985b4ea0 Mon Sep 17 00:00:00 2001 From: K mehant Date: Sat, 1 Jun 2019 12:49:38 +0530 Subject: [PATCH 1/4] Add R devcontainer for statistical computing --- containers/R/.devcontainer/Dockerfile | 18 +++++++ containers/R/.devcontainer/devcontainer.json | 22 +++++++++ containers/R/.npmignore | 4 ++ containers/R/README.md | 49 ++++++++++++++++++++ containers/R/test-project/sample.R | 4 ++ 5 files changed, 97 insertions(+) create mode 100644 containers/R/.devcontainer/Dockerfile create mode 100644 containers/R/.devcontainer/devcontainer.json create mode 100644 containers/R/.npmignore create mode 100644 containers/R/README.md create mode 100644 containers/R/test-project/sample.R diff --git a/containers/R/.devcontainer/Dockerfile b/containers/R/.devcontainer/Dockerfile new file mode 100644 index 0000000000..4134e082c6 --- /dev/null +++ b/containers/R/.devcontainer/Dockerfile @@ -0,0 +1,18 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- + +FROM r-base:3.6.0 + +# Install git, process tools, lsb-release (common in install instructions for CLIs) and GPG +RUN apt-get update && apt-get -y install git procps lsb-release + + +# 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 \ No newline at end of file diff --git a/containers/R/.devcontainer/devcontainer.json b/containers/R/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..6f734f3d59 --- /dev/null +++ b/containers/R/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +{ + "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" }, + + // Uncomment the next line to run commands after the container is created. + // "postCreateCommand": "R --version", + + "extensions": [ + "ikuyadeu.r", + "mikhail-arkhipov.r" + ] +} \ No newline at end of file diff --git a/containers/R/.npmignore b/containers/R/.npmignore new file mode 100644 index 0000000000..1d72d293eb --- /dev/null +++ b/containers/R/.npmignore @@ -0,0 +1,4 @@ +README.md +test-project +.vscode +.npmignore diff --git a/containers/R/README.md b/containers/R/README.md new file mode 100644 index 0000000000..ff1610bc38 --- /dev/null +++ b/containers/R/README.md @@ -0,0 +1,49 @@ +# R + +## Summary + +*Perform statistical computing using R language on linux. Includes R installed and needed extensions* + +| Metadata | Value | +|----------|-------| +| *Contributors* | The VS Code Team, Mehant | +| *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 F1 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 F1 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 F1, and select **Remote-Containers: Open Folder in Container...** +4. Select the `containers/R` folder. +5. After the folder has opened in the container, press F5 to start the project. +6. You should see "Hello, Remote World!" in the a terminal window after the program finishes executing. +7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing. + +## 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). \ No newline at end of file diff --git a/containers/R/test-project/sample.R b/containers/R/test-project/sample.R new file mode 100644 index 0000000000..b4194314c5 --- /dev/null +++ b/containers/R/test-project/sample.R @@ -0,0 +1,4 @@ +# A sample R script + +myString <- "Hello, Remote World!" +print ( myString) \ No newline at end of file From 01e31115c0a0e8c4c45c3af49de4eaae23c902b5 Mon Sep 17 00:00:00 2001 From: K mehant Date: Wed, 5 Jun 2019 12:32:13 +0530 Subject: [PATCH 2/4] Updated Readme properly and removed R Tools extension --- containers/R/.devcontainer/devcontainer.json | 8 +++----- containers/R/README.md | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/containers/R/.devcontainer/devcontainer.json b/containers/R/.devcontainer/devcontainer.json index 6f734f3d59..2d8b9d8194 100644 --- a/containers/R/.devcontainer/devcontainer.json +++ b/containers/R/.devcontainer/devcontainer.json @@ -11,12 +11,10 @@ // Uncomment the next line if you want to add in default container specific settings.json values // "settings": { "workbench.colorTheme": "Quiet Light" }, - - // Uncomment the next line to run commands after the container is created. - // "postCreateCommand": "R --version", + + "postCreateCommand": "R --version", "extensions": [ - "ikuyadeu.r", - "mikhail-arkhipov.r" + "ikuyadeu.r" ] } \ No newline at end of file diff --git a/containers/R/README.md b/containers/R/README.md index ff1610bc38..0dc18158df 100644 --- a/containers/R/README.md +++ b/containers/R/README.md @@ -6,7 +6,7 @@ | Metadata | Value | |----------|-------| -| *Contributors* | The VS Code Team, Mehant | +| *Contributors* | The VS Code Team, [Mehant](mailto:kmehant@gmail.com) | | *Definition type* | Dockerfile | | *Languages, platforms* | R | @@ -38,9 +38,8 @@ This definition includes some test code that will help you verify it is working 2. Clone this repository. 3. Start VS Code, press F1, and select **Remote-Containers: Open Folder in Container...** 4. Select the `containers/R` folder. -5. After the folder has opened in the container, press F5 to start the project. -6. You should see "Hello, Remote World!" in the a terminal window after the program finishes executing. -7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing. +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 Ctrl + Shift + S for Windows users and Change Ctrl to command for Mac users to run the script. ## License From 7d8760e2e493992bee28b46293dae49c946342ca Mon Sep 17 00:00:00 2001 From: K mehant Date: Sun, 9 Jun 2019 11:59:54 +0530 Subject: [PATCH 3/4] Installed .NET core runtime with R installed on top of Ubuntu:bionic and added back R Tools extension --- containers/R/.devcontainer/Dockerfile | 15 ++++++++++++--- containers/R/.devcontainer/devcontainer.json | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/containers/R/.devcontainer/Dockerfile b/containers/R/.devcontainer/Dockerfile index 4134e082c6..0d5502de78 100644 --- a/containers/R/.devcontainer/Dockerfile +++ b/containers/R/.devcontainer/Dockerfile @@ -3,11 +3,20 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -FROM r-base:3.6.0 +FROM rocker/r-apt:bionic -# Install git, process tools, lsb-release (common in install instructions for CLIs) and GPG -RUN apt-get update && apt-get -y install git procps lsb-release +# 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 \ diff --git a/containers/R/.devcontainer/devcontainer.json b/containers/R/.devcontainer/devcontainer.json index 2d8b9d8194..cadf4b77e9 100644 --- a/containers/R/.devcontainer/devcontainer.json +++ b/containers/R/.devcontainer/devcontainer.json @@ -15,6 +15,7 @@ "postCreateCommand": "R --version", "extensions": [ - "ikuyadeu.r" + "ikuyadeu.r", + "mikhail-arkhipov.r" ] } \ No newline at end of file From 0ed21d02db0b96503a140b5c168570cfbfdbd314 Mon Sep 17 00:00:00 2001 From: K mehant Date: Sun, 9 Jun 2019 12:03:50 +0530 Subject: [PATCH 4/4] Updated contributors --- containers/R/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/R/README.md b/containers/R/README.md index 0dc18158df..493d9c398e 100644 --- a/containers/R/README.md +++ b/containers/R/README.md @@ -6,7 +6,7 @@ | Metadata | Value | |----------|-------| -| *Contributors* | The VS Code Team, [Mehant](mailto:kmehant@gmail.com) | +| *Contributors* | [Mehant](mailto:kmehant@gmail.com) | | *Definition type* | Dockerfile | | *Languages, platforms* | R |