Skip to content

Commit

Permalink
fix conda in container
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperSkytte committed May 3, 2024
1 parent 3eea058 commit 82e8c20
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
24 changes: 12 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.194.0/containers/docker-existing-dockerfile
{
"name": "mc-prediction",
"image": "ghcr.io/kasperskytte/mc-prediction:main",
// "image": "ghcr.io/kasperskytte/mc-prediction:main",

// "build": {
// // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
// "dockerfile": "../Dockerfile"
// },
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
},

"initializeCommand": "docker pull ghcr.io/kasperskytte/mc-prediction:main",
// "initializeCommand": "docker pull ghcr.io/kasperskytte/mc-prediction:main",

// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/opt/conda/envs/mc-prediction/bin/python3.8",
"r.bracketedPaste": true,
"r.rterm.linux": "/usr/local/bin/radian", //Use this only for Linux
"r.lsp.path": "/usr/local/bin/R",
"r.rterm.linux": "/opt/conda/envs/mc-prediction/bin/radian",
"r.lsp.path": "/opt/conda/envs/mc-prediction/bin/R",
"r.lsp.debug": true,
"r.lsp.diagnostics": true,
"r.rterm.option": [
"--no-save",
"--no-restore",
"--r-binary=/usr/local/bin/R"
"--r-binary=/opt/conda/envs/mc-prediction/bin/R"
]
},

Expand Down Expand Up @@ -53,9 +56,6 @@
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode",

// Don't override entrypoint
"overrideCommand": false,

// Uncomment to keep the container running when disconnecting from it
"shutdownAction": "none"
}
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ RUN export DEBIAN_FRONTEND=noninteractive \
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py38_23.11.0-2-Linux-x86_64.sh -O /opt/miniconda.sh \
&& /bin/bash /opt/miniconda.sh -b -p /opt/conda \
&& rm -rf /opt/miniconda.sh \
&& conda env create -f /opt/environment.yml -n mc-prediction
&& conda env create -f /opt/environment.yml -n mc-prediction \
&& ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh \
&& echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc \
&& echo "conda activate mc-prediction" >> ~/.bashrc

# Make RUN commands use the new environment
SHELL ["conda", "run", "-n", "mc-prediction", "/bin/bash", "-c"]
Expand Down
5 changes: 5 additions & 0 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,11 @@
],
"Hash": "3d5108641f47470611a32d0bdf357a72"
},
"languageserver": {
"Package": "languageserver",
"Version": "0.3.16",
"Source": "Repository"
},
"later": {
"Package": "later",
"Version": "1.3.1",
Expand Down

0 comments on commit 82e8c20

Please sign in to comment.