multi-stage dockerfile: This reduces image size to half compare to ea…#200
multi-stage dockerfile: This reduces image size to half compare to ea…#200StarTrooper08 wants to merge 1 commit intodevelfrom
Conversation
…rlier image version size
|
This looks okay to me, but I see ubuntu 22.04 is hard-coded. Maybe we can use |
|
If we use just ubuntu instead of ubuntu:22, it will automatically used as latest. |
|
If we use ubuntu latest, then we can also prefer r-universe over CRAN when installing R packages, so that we install from the linux binary rather than from source, i.e. This should save quite a lot of time in the build. |
|
Sure updating the file shortly. |
|
(I was just randomly follow a few R dev related repos) Just to point out that URL for the r-universe cran linux binary repo doesn't look correct - as far as I know it is
which you can infer from https://docs.r-universe.dev/install/binaries.html or by hovering your mouse over a Linux package on any package page under https://cran.r-universe.dev/ e.g. https://cran.r-universe.dev/MRAM and httpgd (as regularly happens) currently isn't on CRAN so you can obtain that from it's developer's r-universe |
|
Thanks for the correction @remlapmot. We don't want to hardcode the distro, architecture or R version, so we can do Rscript -e "runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/', \
system2('lsb_release', '-sc', stdout = TRUE), \
R.version\$arch, \
substr(getRversion(), 1, 3)); \
install.packages(c('languageserver', 'httpgd'), \
repos = c(runiverse = paste0('https://cran.', runiverse), \
nx10 = paste0('https://nx10.', runiverse)))" I've tested this out in a Rocker container to confirm it works. |
multi-stage dockerfile: This reduces image size to half compare to earlier image version size.
Before multi-stage build

After multi-stage build(r-multi-stage build -> r-dev-env image)
