I am trying to use Docker and ShinyProxy for the first time and I am struggling a lot at the very beginning of the process.
I developed some shiny apps that work well locally and I am thinking about deploying them in some articles of my website.
Those shiny apps use 2 packages that I have coded myself and that are located locally on my computer.
How can I install those private R packages in my Dockerfile so that the 'container' will have access to them???
I have seen tons of examples installing packages from CRAN, which I have no problem with. However, I cannot find the way to install my own packages from a local repository.
At the moment, I have a folder called 'DockerEC' with the following files:
'App.R'
'run_app.R'
'installpackages.R'
'Dockerfile'
In my local shiny apps, I install those packages simply using:
install.packages("/Users/name/Documents/R/Package_NAME", repos = NULL, type="source")
I wrote this line of code in my installpackages.R file but I cannot Run this file as I get an error: 'no such file or directory'.
I used
COPY /Users/name/Documents/R/DockerEC/installpackages.R /Users/name/Documents/R/DockerEC/installpackages.R
and then
RUN Rscript /Users/name/Documents/R/DockerEC/installpackages.R
in my docker file but don't get why I am not finding the file?
Anyone has a concrete example of a way of installing private R package in the dockerfile? I am missing a concrete example to understand how to do it...
Try the Dockerfile
below, it works for me:
FROM rocker/r-ver:3.6.1
RUN mkdir ./private_pkgs
COPY /Users/name/Documents/R/your_package.tar.gz ./private_pkgs/your_package.tar.gz
RUN R -e "install.packages('private_pkgs/your_package.tar.gz', repos = NULL, type = 'source')"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.