plumber icon indicating copy to clipboard operation
plumber copied to clipboard

Add support for ARM docker images

Open tylerlittlefield opened this issue 4 years ago • 3 comments

The rstudio/plumber image only supports linux/amd64 but it would be nice to also support linux/arm64. I am currently doing this by using r-base image which supports ARM CPUs already. See https://github.com/tyluRp/pirate/blob/master/plumber/Dockerfile_latest#L3.

And I push both architectures with https://github.com/tyluRp/pirate/blob/master/.github/workflows/build-plumber.yml#L53

So I think this change would only require:

  1. Using r-base image: https://hub.docker.com/_/r-base
  2. Update the github action to support multi-arch uploads

I should also note that the build time for these is long, like 2 hours long. So there could probably be some improvements to what I am currently doing.

tylerlittlefield avatar Jun 02 '21 16:06 tylerlittlefield

Your docker action file seems pretty good. Feel free to submit a PR. 😃

If adding platforms doesn't do anything to me, other than uploading more images, then I'm happy to upload more images as it is not my server.

However, plumber docker files need to be able to fix to a specific R version. So until rocker/r-ver updates to allow for multiple architecture, I guess we are stuck. If rocker/r-ver already works on multiple platforms... great!


note that the build time for these is long, like 2 hours long.

I looked at your logs from https://github.com/tyluRp/pirate/runs/2724721891 and copied in a raw log output below.

2021-06-02T05:06:08.4154810Z #9 1408.7 installing via 'install.libs.R' to /usr/local/lib/R/site-library/00LOCK-stringi/00new/stringi
2021-06-02T05:06:09.0137344Z #9 1409.3 ** R
2021-06-02T05:06:09.2687942Z #9 1409.6 ** inst
2021-06-02T05:06:09.4191332Z #9 1409.6 ** byte-compile and prepare package for lazy loading
2021-06-02T05:06:18.8762002Z #9 1419.1 ** help
2021-06-02T05:06:21.8782565Z #9 1422.1 *** installing help indices
2021-06-02T05:06:23.4825851Z #9 1423.8 ** building package indices
2021-06-02T05:06:27.2058531Z #9 1427.5 ** testing if installed package can be loaded from temporary location
2021-06-02T05:06:29.4574540Z #9 1429.6 ** checking absolute paths in shared objects and dynamic libraries
2021-06-02T05:06:29.8637622Z #9 1430.2 ** testing if installed package can be loaded from final location
2021-06-02T05:06:31.9460748Z #9 1432.3 ** testing if installed package keeps a record of temporary installation path
2021-06-02T05:06:32.0965481Z #9 1432.3 * DONE (stringi)

The stringi installation took 20mins to complete. Above is the last steps of the installation output. These steps are taking 20s to complete, it should be relatively instant.

2021-06-02T04:41:37.1339081Z #14 [linux/amd64 4/5] RUN Rscript -e "remotes::install_github('rstudio/plumber@master')"
.........
2021-06-02T04:42:49.7342027Z #9 [linux/arm64 4/5] RUN Rscript -e "remotes::install_github('rstudio/plumber@master')"
.........
2021-06-02T04:47:03.2095666Z #14 DONE 326.2s
.........
2021-06-02T05:36:21.2777552Z #9 DONE 3221.6s

It also looks like the amd and arm are processing at the same time. I believe this is leading to squeezing the memory too much on the GHA machines, which is why it slows down to a crawl.

Is it possible to build to in two separate steps? Or even use a workflow Action matrix to run the whole workflow file in parallel for the different platforms?

schloerke avatar Jun 02 '21 17:06 schloerke

However, plumber docker files need to be able to fix to a specific R version. So until rocker/r-ver updates to allow for multiple architecture, I guess we are stuck. If rocker/r-ver already works on multiple platforms... great!

Exactly right, rocker:r-ver doesn't support ARM at this time but r-base does and r-base also supports version tagging. See here: https://hub.docker.com/_/r-base?tab=tags&page=1&ordering=last_updated

It looks like ARM support starts at version 3.5.1. If you want to keep using rocker/r-ver that's totally fine. This is just a nice to have 😄

Is it possible to build to in two separate steps? Or even use a workflow Action matrix to run the whole workflow file in parallel for the different platforms?

I can give this a try on my current workflows, thanks for the suggestion! I was also thinking that I might set the CRAN repo to package manger in hopes that installing binaries will improve performance https://github.com/rocker-org/rocker-versioned2/blob/master/dockerfiles/Dockerfile_r-ver_4.0.3#L13.

tylerlittlefield avatar Jun 02 '21 17:06 tylerlittlefield

Hello. Currently rocker/r-ver is also built on linux/arm64 so you can run multi-arch builds. I thought about tackling this but wasn't confident in writing the correct action file as the tag setup is quite intricate.

eitsupi avatar Jul 12 '22 15:07 eitsupi