Closed JosiahParry closed 2 years ago
Please let me know if there is anything I can do or modify.
Hey,
Will review that PR on friday.
Thanks again !
As of now I have the following issue :
> dockerfiler::dock_from_renv()
Error in lock$version() : attempt to apply non-function
It happens in
dock <- Dockerfile$new(gen_base_image(distro = distro, r_version = lock$version()))
Browse[2]> names(lock)
[1] "remove" "write" "repos" "data" "add"
Refactor with
lock$data()$R$Version
@statnmap thank you for bringing this back to the fore. I'll begin work on this shortly.
I've made the suggested changes, thought there are some conflicts now :/
Resolved conflicts. Ready for review.
Thanks a lot for your contribution.
I did a few changes, added documentation and unit tests.
Also took the opportunity to update some other files while in it.
Looks good! My only comment is that by removing "use_rspm" users are now required to specify repos manually rather than be inferred from the lock file. The other challenge I see from this is build times might be slower since the default repo for most people will be CRAN and renv will install from source instead.
This PR adds a new function dock_from_renv() which creates a Dockerfile from an renv.lock file.
By default, this function uses the RStudio Public Package Manager (PPM) (use_rspm = TRUE) which enables us to utilize the Linux binaries provided by it. When this argument is set to true, it creates a new file renv.lock.dock which is copied into the Dockerfile as renv.lock. The purpose of this is to leave the existing renv.lock alone and still usable for individual development.
This function uses {pak} to resolve package dependencies and as such is added as an imported package.
A current limitation is that pak returns only the install commands and not the library names themselves. As such each sysdep is added in its own layer. This goes against the convention of installing all sysdeps in one layer. This will likely lead to marginally larger docker images. But I think thats a fair cost for convenience.