File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// README at: https://github.com/devcontainers/templates/tree/main/src/python
33{
44 "name" : " OpenSAFELY" ,
5- "image" : " ghcr.io/opensafely-core/research-template:v0 " ,
5+ "image" : " mcr.microsoft.com/devcontainers/base:ubuntu-22.04 " ,
66 // Features to add to the dev container. More info: https://containers.dev/features.
77 "features" : {
88 "ghcr.io/devcontainers/features/docker-in-docker:2" : {}
99 },
10- "postCreateCommand" : " /bin/bash /opt/ devcontainer/postCreate.sh ${containerWorkspaceFolder} " ,
11- "postAttachCommand" : " /bin/bash /opt/ devcontainer/postAttach.sh" ,
10+ "postCreateCommand" : " /bin/bash . devcontainer/postCreate.sh" ,
11+ "postAttachCommand" : " /bin/bash . devcontainer/postAttach.sh" ,
1212 "forwardPorts" : [
1313 8787
1414 ],
4141 "files.autoSaveDelay" : 1000 ,
4242 "git.autofetch" : true ,
4343 "python.analysis.extraPaths" : [" .devcontainer/ehrql-main/" ],
44- "python.defaultInterpreterPath" : " /opt /venv/bin/python" ,
44+ "python.defaultInterpreterPath" : " . /venv/bin/python" ,
4545 "python.terminal.activateEnvInCurrentTerminal" : true ,
4646 "python.terminal.activateEnvironment" : true ,
4747 "window.autoDetectColorScheme" : true
Original file line number Diff line number Diff line change 1+ opensafely launch rstudio -p 8787 &
Original file line number Diff line number Diff line change 1+ # download and extract latest ehrql source
2+ wget https://github.com/opensafely-core/ehrql/archive/main.zip -P .devcontainer
3+ unzip -o .devcontainer/main.zip -d .devcontainer/
4+ rm .devcontainer/main.zip
5+
6+ # install python and dependencies, set up virtualenv
7+ sudo apt update
8+ wget https://github.com/opensafely-core/python-docker/raw/refs/heads/main/v2/dependencies.txt -q -O - | sed ' s/^#.*//' | sudo xargs apt-get install --yes --no-install-recommends
9+ pip install virtualenv opensafely
10+ python3 -m virtualenv .venv
11+ rm -rf .venv/lib
12+ docker container create --name python-v2 ghcr.io/opensafely-core/python:v2
13+ docker cp python-v2:/opt/venv/lib .venv/
14+ docker rm python-v2
15+
16+ # install R and dependencies
17+ echo " deb https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" | sudo tee /etc/apt/sources.list.d/cran.list > /dev/null
18+ sudo /usr/lib/apt/apt-helper download-file ' https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc' /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
19+ sudo apt update
20+ wget https://raw.githubusercontent.com/opensafely-core/r-docker/refs/heads/main/v2/dependencies.txt -q -O - | sed ' s/^#.*//' | sudo xargs apt-get install --yes --no-install-recommends
21+ wget https://raw.githubusercontent.com/opensafely-core/r-docker/refs/heads/main/scripts/rprofile-site-append-1.R -q -O - | sudo tee -a /usr/lib/R/etc/Rprofile.site > /dev/null
22+ wget https://raw.githubusercontent.com/opensafely-core/r-docker/refs/heads/main/scripts/rprofile-site-append-2.R -q -O - | sudo tee -a /usr/lib/R/etc/Rprofile.site > /dev/null
23+ docker create --name r-v2 --rm ghcr.io/opensafely-core/r:v2
24+ sudo docker cp r-v2:/usr/local/lib/R/site-library /usr/local/lib/R/
25+ sudo chown -R vscode:vscode /usr/local/lib/R/site-library/
You can’t perform that action at this time.
0 commit comments