-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from epiforecasts/feature-add-vscode-docker
Add docker + vscode support
- Loading branch information
Showing
5 changed files
with
588 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ | |
^doc$ | ||
^Meta$ | ||
^_pkgdown\.yml$ | ||
^\.devcontainer$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# R version: 4, 4.1, 4.0 | ||
ARG VARIANT="4" | ||
FROM rocker/r-ver:${VARIANT} | ||
|
||
# Use the [Option] comment to specify true/false arguments that should appear in VS Code UX | ||
# | ||
# [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=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
COPY .devcontainer/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 \ | ||
&& 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 \ | ||
&& 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)" | ||
|
||
RUN apt-get update \ | ||
&& export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends libglpk-dev libv8-dev \ | ||
pandoc-citeproc libpng-dev | ||
|
||
# install vscode dev deps | ||
RUN Rscript -e 'devtools::install_github("mdlincoln/docthis")' | ||
|
||
# install dependencies | ||
COPY DESCRIPTION /tmp/package/DESCRIPTION | ||
RUN Rscript -e "devtools::install_deps('/tmp/package', dependencies = TRUE)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 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.209.6/containers/r | ||
{ | ||
"name": "scoringutils", | ||
"image": "ghcr.io/epiforecasts/scoringutils:master", | ||
|
||
// 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": [ | ||
"ikuyadeu.r", | ||
"tomoki1207.pdf", | ||
"github.vscode-pull-request-github", | ||
"formulahendry.code-runner", | ||
"mutantdino.resourcemonitor", | ||
"searking.preview-vscode" | ||
], | ||
|
||
// 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 connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode" | ||
} |
Oops, something went wrong.