A causa di una applicazione legacy dovevo dovevo usare R ver 3 che non eà compatibile con R ver 4 (era esclusa la riscittura del codice)
Dopo un po' di tentativi la strada piu' lineare e' stata quella di creare un container con il seguente Dockerfile che installa anche tutti i packages delle dipendenze
FROM rstudio/r-base:3.6-bookworm
RUN apt-get -y update
RUN apt-get -y install gdal-bin libgdal-dev libpng-dev libudunits2-dev libfontconfig1-dev libmagick++-dev
RUN curl -O "https://cran.r-project.org/src/contrib/Archive/randomForest/randomForest_4.6-10.tar.gz"
#setup R configs
RUN echo "r <- getOption('repos'); r['CRAN'] <- 'http://cran.us.r-project.org'; options(repos = r);" > ~/.Rprofile
RUN Rscript -e "install.packages('zoo')"
RUN Rscript -e "install.packages('leaflet')"
RUN Rscript -e "install.packages('sf')"
RUN Rscript -e "install.packages('leafpop')"
RUN Rscript -e "install.packages('forecast')"
RUN Rscript -e "install.packages('stringr')"
RUN Rscript -e "install.packages('lubridate')"
RUN Rscript -e "install.packages('randomForest_4.6-10.tar.gz', repos = NULL, type='source')"
RUN Rscript -e "install.packages('rpart')"
RUN Rscript -e "install.packages('e1071')"
RUN Rscript -e "install.packages('kknn')"
RUN Rscript -e "install.packages('jpeg')"
RUN Rscript -e "install.packages('data.table')"
RUN Rscript -e "install.packages('tidyr')"
RUN Rscript -e "install.packages('magick')"
RUN Rscript -e "install.packages('leaflet.extras')"
RUN Rscript -e "install.packages('leafem')"
RUN Rscript -e "install.packages('raster')"
docker build -t nome_docker .
Per usare il container
docker run --rm -it -v /home/luca:/mnt nome_docker bash
Nessun commento:
Posta un commento