Have you ever tried dockerfiler::dock_from_renv()? Looks like it could replace much of that code, if I understand correctly (but I can also see why you might want finer control over what ends up in the Dockerfile)
https://thinkr-open.github.io/dockerfiler/reference/dock_from_renv.html
@andrew
Maybe
apt-cache depends <pkg>?
Like:
> apt-cache depends r-base
>r-base
> Depends: r-base-core
> Depends: r-recommended
> Recommends: r-base-html
> Recommends: r-doc-html
> Suggests: elpa-ess
> |Suggests: r-doc-info
> Suggests: r-doc-pdf
For example (root required for `apt install`):
apt-cache depends r-base | grep 'Depends:' | awk '{print $2}' | xargs apt install
@andrew
Sorry I missread, you mean when installing r-packages.
Posit package manager might help. It tell you for each package and distro the install commands necessary for system dependencies.
https://packagemanager.posit.co/client/#/repos/cran/packages/overview?search=igraph
@andrew I just replied over on the bluer sky site mentioning #r2u (and thanks to @erikjan and @jrosell who mentioned it here) with post a quick post (https://bsky.app/profile/eddelbuettel.com/post/3ks7ifs2tw32l) and a follow-up (https://bsky.app/profile/eddelbuettel.com/post/3ks7j6yaq522h) showing a minimal Dockerfile and its use. 43 seconds here. #rstats
#r2u: Fast. Easy. Reliable.
If you base your container on r2u you can write `install.packages()` listing the #Rstats packages. `bspm` then _resolves all R packages by installing the apt package and their dependencies_ via the integration to the system manager. #r2u. Fast. Easy, Reliable. eddelbuettel.github.io/r2u/ https://eddelbuettel.github.io/r2u/
@andrew If you use one of the rig containers [1], it is set up for binary R packages (on amd64) and automatic system package installation (or any arch), so all you need is
FROM ghcr.io/r-lib/rig/ubuntu-22.04-release
RUN R -q -e 'pak::pkg_install("tidyverse")'
Or you can use any container you like, install pak [2], and set up binary packages [3] manually if you like
[1] https://github.com/r-lib/rig#id-container
[2] https://pak.r-lib.org/reference/install.html
[3] https://packagemanager.posit.co/
@andrew Also, if you just want to look them up, this works on any system:
pak::pkg_sysreqs("tidyverse", sysreqs_platform="ubuntu-22.04")
@andrew @gaborcsardi along this line, we've run into this problem enough that we've set up a GH action to check all our R-centric docker images for the sysdeps.
https://github.com/RMI-PACTA/actions/blob/main/.github/workflows/docker-check-R-sysdeps.yml