Skip to content

Commit

Permalink
Switch to conda environment
Browse files Browse the repository at this point in the history
  • Loading branch information
nictru committed May 5, 2024
1 parent 41fbfff commit 7c8f249
Show file tree
Hide file tree
Showing 9 changed files with 459 additions and 55 deletions.
18 changes: 16 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# r2u only supports amd64
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/base:focal
FROM mcr.microsoft.com/devcontainers/miniconda:0-3

# Copy environment.yml (if found) to a temp location so we update the environment. Also
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
&& rm -rf /tmp/conda-tmp

# [Optional] Uncomment to install a different version of Python than the default
# RUN conda install -y python=3.6 \
# && pip install --no-cache-dir pipx \
# && pipx reinstall-all

# [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>
45 changes: 14 additions & 31 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,30 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/rocker-org/devcontainer-templates/tree/main/src/r2u
// README at: https://github.com/devcontainers/templates/tree/main/src/miniconda
{
"name": "R (r2u and bspm configured)",
"build": {
"name": "Miniconda (Python 3)",
"build": {
"context": "..",
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"Posit.shiny-python"
]
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
// A Feature to configure R on Ubuntu. More info: https://github.com/rocker-org/devcontainer-features/tree/main/src/r-apt.
"ghcr.io/rocker-org/devcontainer-features/r-apt:0": {
"vscodeRSupport": "full",
"installDevTools": true,
"installRMarkdown": true,
"installRadian": true,
"installVscDebugger": true,
"installBspm": true,
}
},
// "features": {},

// 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": "./requirements_sudo.sh",
// "postCreateCommand": "python --version",

// Configure tool-specific properties.
"customizations": {
// Settings for VS Code.
"vscode": {
"extensions": [
"RDebugger.r-debugger",
"ms-python.python",
"Posit.shiny-python",
"ms-azuretools.vscode-docker"
],
"settings": {
"r.rterm.linux": "/usr/local/bin/radian",
"r.bracketedPaste": true,
"r.plot.useHttpgd": true
}
}
},
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/environment.yml
3 changes: 3 additions & 0 deletions .devcontainer/noop.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file is copied into the container along with environment.yml* from the
parent folder. This is done to prevent the Dockerfile COPY instruction from
failing if no environment.yml is found.
Loading

0 comments on commit 7c8f249

Please sign in to comment.