Skip to content

Commit

Permalink
Merge pull request epiforecasts#393 from epiforecasts:devcontainer
Browse files Browse the repository at this point in the history
Devcontainer
  • Loading branch information
seabbs authored Jul 1, 2021
2 parents 9df009d + 6dc82c0 commit 4ad5583
Show file tree
Hide file tree
Showing 7 changed files with 544 additions and 15 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ SMG.md
^.*.pdf$
^inst/paper$
^inst/examples$
^\.devcontainer$
47 changes: 47 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# R version: latest, ... ,4.0.1 , 4.0.0
ARG VARIANT="latest"
FROM rocker/verse:${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=1100
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

RUN python3 -m pip --no-cache-dir install radian pre-commit
RUN install2.r --error --skipinstalled --repos ${CRAN} --ncpus -1 \
devtools \
languageserver \
precommit \
git2r \
&& rm -rf /tmp/downloaded_packages

# [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>

# install dependencies
COPY DESCRIPTION /tmp/package/DESCRIPTION
RUN Rscript -e "devtools::install_dev_deps('/tmp/package')"

# add docthis
RUN Rscript -e 'devtools::install_github("mdlincoln/docthis")'
42 changes: 42 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// 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.183.0/containers/r
{
"name": "covidregionaldata",
"build": {
"dockerfile": "Dockerfile",
// Update VARIANT to pick a specific R version: latest, ... ,4.0.1 , 4.0.0
"args": { "VARIANT": "latest" },
"context": ".."
},

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

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

// 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",

// Uncomment to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

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

0 comments on commit 4ad5583

Please sign in to comment.