Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve devcontainers #120

Merged
merged 8 commits into from
May 10, 2024
Merged

Improve devcontainers #120

merged 8 commits into from
May 10, 2024

Conversation

lucyb
Copy link
Contributor

@lucyb lucyb commented Apr 23, 2024

References opensafely-core#43 and opensafely-core#9

Fixes #104 and opensafely-core#43.

This will provide a development environment for researchers containing:

  • Python 3.10
  • The equivalent Python packages based on the Python Action image, including ehrql
  • R 4.0.5
  • RStudio
  • The equivalent R packages based on the R Action image

This can be used in Codespaces or locally via devcontainers in VS Code.

@lucyb lucyb force-pushed the improve-devcontainers branch 2 times, most recently from 79b8e09 to 53bcc06 Compare April 24, 2024 08:58
@Jongmassey
Copy link
Contributor

Looking at Tom P's comments in the other thread, I see that not copying across the renv from the OpenSAFELY R action image saves a bunch of space, but unless Tom updates his base image we're going to miss any updates to the OpenSAFELY R package list. Did the base rstudio image not work?

@Jongmassey Jongmassey force-pushed the improve-devcontainers branch from 6c0cf3e to f2394cc Compare April 26, 2024 08:29
@Jongmassey
Copy link
Contributor

The Dockerfile now references the base rocker image and in my testing works fine. Autocompletion in r-studio works and all the libraries in the renv are present. Image size is now 5.44GB, which isn't great but is better than 8GB. Need to double-check all things Python are fine

.devcontainer/Dockerfile Outdated Show resolved Hide resolved
lucyb added a commit to opensafely-core/research-template-docker that referenced this pull request Apr 26, 2024
This copies the updated dockerfile from the research-template repo (see this
[PR](opensafely/research-template#120)).
lucyb added a commit to opensafely-core/research-template-docker that referenced this pull request Apr 26, 2024
This copies the updated dockerfile from the research-template repo (see this
[PR](opensafely/research-template#120)).
lucyb added a commit to opensafely-core/research-template-docker that referenced this pull request Apr 26, 2024
This copies the updated dockerfile from the research-template repo (see this
[PR](opensafely/research-template#120)).
lucyb added a commit to opensafely-core/research-template-docker that referenced this pull request Apr 26, 2024
This copies the updated dockerfile from the research-template repo (see this
[PR](opensafely/research-template#120)).
lucyb added a commit to opensafely-core/research-template-docker that referenced this pull request Apr 26, 2024
This copies the updated dockerfile from the research-template repo (see this
[PR](opensafely/research-template#120)).
lucyb added a commit to opensafely-core/research-template-docker that referenced this pull request Apr 26, 2024
This copies the updated dockerfile from the research-template repo (see this
[PR](opensafely/research-template#120)).
lucyb added a commit to opensafely-core/research-template-docker that referenced this pull request Apr 26, 2024
This copies the updated dockerfile from the research-template repo (see this
[PR](opensafely/research-template#120)).
lucyb added a commit to opensafely-core/research-template-docker that referenced this pull request Apr 26, 2024
This copies the updated dockerfile from the research-template repo (see this
[PR](opensafely/research-template#120)).
@remlapmot
Copy link
Contributor

Just checking - are you sure that renv is configured correctly in this updated version?

On starting an RStudio session I think I see only 32 R packages. If I then run renv::activate() I get 30 packages; whereas the current magic number for the r image is 438 packages.

Screenshot 2024-04-28 at 20 45 56

In /renv/lib/R-4.0/x86_64-pc-linux-gnu I see 422 packages (last time I saw 424 - not sure why 2 fewer this time) but I think you are still missing the /usr/lib/R/library packages from the r image (which renv::activate() needs to find).

More simply you could try copying the packages from the r image into the system R package directories, such as /usr/local/lib/R/site-library (then there'd be no need to worry about renv::activate()-ing. I would probably clear out the system package directory first as there are packages in it from rocker). I admit that when I made my Dockerfile I didn't realise it is possible to copy files between images like this.

lucyb added a commit to opensafely-core/research-template-docker that referenced this pull request Apr 30, 2024
This copies the updated dockerfile from the research-template repo (see this
[PR](opensafely/research-template#120)).
.devcontainer/postCreate.sh Outdated Show resolved Hide resolved
@Jongmassey Jongmassey force-pushed the improve-devcontainers branch 2 times, most recently from fc046f6 to a17f11a Compare May 3, 2024 11:23
@Jongmassey Jongmassey marked this pull request as ready for review May 3, 2024 11:24
@Jongmassey Jongmassey force-pushed the improve-devcontainers branch from a17f11a to 597b597 Compare May 3, 2024 11:27
lucyb and others added 3 commits May 3, 2024 14:44
Use the image from opensafely-core/research-template-docker
rather than the Microsoft devcontainer image as a base.

For this initial version, I build the image locally and uploaded it using these
[instructions](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry).
@Jongmassey Jongmassey force-pushed the improve-devcontainers branch from d113a9f to 289de8f Compare May 9, 2024 15:30
The ehrql extension is downloaded and referenced in vs code separately rather
than being installed using pip because it requires a newer version of python
(3.11 rather than the 3.10 required for the analysis code).

Remove ehrql from requirements.in

Co-authored-by: Jon Massey <[email protected]>
lucyb and others added 4 commits May 10, 2024 09:59
This is so we can use the packages copied over from the python action image.

Co-authored-by: Jon Massey <[email protected]>
and remove vestigial config added for gitpod
@Jongmassey Jongmassey force-pushed the improve-devcontainers branch from 289de8f to ee48aa5 Compare May 10, 2024 09:01
@Jongmassey Jongmassey merged commit 7788bb3 into main May 10, 2024
1 check passed
@Jongmassey Jongmassey deleted the improve-devcontainers branch May 10, 2024 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make dev container setup a more complete development environment
4 participants