Skip to content

Commit

Permalink
fix: working Dockerfile \o/
Browse files Browse the repository at this point in the history
This change fixes the longstanding issue of not being able to rebuild
our R image, which was causing many issues.

It solves the problem of reproducing the R library versions as in the
current R docker image by using renv to manage a lockfile of versions.

This is bit nuanced - renv is not really designed for this use case
- but it does work. Check the Dockerfile comments for details. With
a cold cache, it is very slow to build all the initial packages (i.e.
1-2 hours). But the build process keeps a local cache of them on the
host, so rebuilds are fast.

Whilst there are no R library version changes, there are some system
library changes, as we moved from 18.04 to 20.04 as a base image. This
was necessary because a) 18.04 is EOL shortly and b) we don't maintain
a base 18.04 image.  The file `20.04-library-changes.txt` contains
a summary of differences, basically a bunch of uprades to system
libraries. Also, we upgraded to the latest point release of R 4.0
series, 4.0.2 -> 4.0.5.

Additionally, many unused components have been removed from the image:
 - all build toolchain/-dev packages
 - java/python integration
 - various x11/gtk dependencies

These made the original image heavier, and to the best of our knowledge,
have never been used by any projects. If this turns out to be
mistaken, we can add things back easily enough. The old image was 4.5G
from dockers
- the new one is 1.9G.

Testing:

An R image build with this process was used to test ~30 OpenSAFELY
project.yamls with R code in, and it all worked, so we have some
confidence we've not broken anything.

We'll keep the old image unter r:legacy tag or something, so we can
easily access it if needed.

Note: this does not add a publishing workflow to the repo, and thus does
not change the current image by landing.

Whether we can build it in GH remains to be seend. With no cache, I'd
expect it to take multiple hours.
  • Loading branch information
bloodearnest committed Jan 27, 2023
1 parent 002b03e commit fc417c6
Show file tree
Hide file tree
Showing 15 changed files with 5,458 additions and 284 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*~
renv.lock.bak
.tests.R
Loading

0 comments on commit fc417c6

Please sign in to comment.