Skip to content

Commit

Permalink
vscode setting and other file added
Browse files Browse the repository at this point in the history
  • Loading branch information
Yousuf28 committed Jan 5, 2023
1 parent 696408e commit c79b618
Show file tree
Hide file tree
Showing 6 changed files with 639 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# [Choice] R version: 4, 4.2, 4.1, 4.0
ARG VARIANT=4
# [Choice] Base image. Minimal (r-ver), tidyverse installed (tidyverse), or full image (binder): rocker/r-ver, rocker/tidyverse, rocker/binder
ARG BASE_IMAGE=rocker/r-ver
FROM ${BASE_IMAGE}:${VARIANT}

# [Option] Install zsh
ARG INSTALL_ZSH="true"
# [Option] Upgrade OS packages to their latest versions
ARG UPGRADE_PACKAGES="false"

# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
ARG USERNAME=rstudio
ARG USER_UID=1000
ARG USER_GID=$USER_UID
USER root
COPY library-scripts/*.sh /tmp/library-scripts/
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
&& usermod -a -G staff ${USERNAME} \
&& apt-get -y install \
python3-pip \
libgit2-dev \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libxt-dev \
libfontconfig1-dev \
libcairo2-dev \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts \
&& python3 -m pip --no-cache-dir install radian \
&& install2.r --error --skipinstalled --ncpus -1 \
devtools \
languageserver \
httpgd \
shiny \
ggplot2 \
data.table \
dplyr \
shinycssloaders \
DT \
officer \
flextable \
ggiraph \
patchwork \
RSQLite \
htmltools \
shinyjs \
RColorBrewer \
stringr \
shinytest2 \
shinyvalidate \

&& rm -rf /tmp/downloaded_packages

# VSCode R Debugger dependency. Install the latest release version from GitHub without using GitHub API.
# See https://github.com/microsoft/vscode-dev-containers/issues/1032
RUN export TAG=$(git ls-remote --tags --refs --sort='version:refname' https://github.com/ManuelHentschel/vscDebugger v\* | tail -n 1 | cut --delimiter='/' --fields=3) \
&& Rscript -e "remotes::install_git('https://github.com/ManuelHentschel/vscDebugger.git', ref = '"${TAG}"', dependencies = FALSE)"

# R Session watcher settings.
# See more details: https://github.com/REditorSupport/vscode-R/wiki/R-Session-watcher
RUN echo 'if (interactive() && Sys.getenv("TERM_PROGRAM") == "vscode") source(file.path(Sys.getenv("HOME"), ".vscode-R", "init.R"))' >>"${R_HOME}/etc/Rprofile.site"

# [Option] Enable vscode-jupyter support
ARG ENABLE_JUPYTER="false"
RUN if [ "${ENABLE_JUPYTER}" = "true" ]; then \
if [ -z "$(dpkg --get-selections | grep libzmq3-dev)" ]; then \
apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends libzmq3-dev \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*; \
fi \
&& install2.r --error --skipinstalled --ncpus -1 IRkernel \
&& rm -rf /tmp/downloaded_packages \
&& python3 -m pip --no-cache-dir install jupyter \
&& R --vanilla -s -e 'IRkernel::installspec(user = FALSE)'; \
fi

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update \
# && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this section to install additional R packages.
# RUN install2.r --error --skipinstalled --ncpus -1 <your-package-list-here>
49 changes: 49 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/r
{
"name": "R (Community)",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update VARIANT to pick a R version: 4, 4.2, 4.1, 4.0
"VARIANT": "4.1",
// Start with a minimal image (rocker/r-ver) or a expanded image.
// See more details about rocker/r-ver's derived images: https://github.com/rocker-org/rocker-versioned2
"BASE_IMAGE": "rocker/r-ver",
// Options
"ENABLE_JUPYTER": "false",
"UPGRADE_PACKAGES": "true"
}
},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"r.rterm.linux": "/usr/local/bin/radian",
"r.bracketedPaste": true,
"r.plot.useHttpgd": true,
"[r]": {
"editor.wordSeparators": "`~!@#%$^&*()-=+[{]}\\|;:'\",<>/?"
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"reditorsupport.r",
"rdebugger.r-debugger"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "R --version",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "rstudio"
}
Loading

0 comments on commit c79b618

Please sign in to comment.