-
Gael MILLOT authoredGael MILLOT authored
Dockerfile 6.19 KiB
#########################################################################
## ##
## Dockerfile ##
## R extended ##
## ##
## Gael A. Millot ##
## Bioinformatics and Biostatistics Hub ##
## Computational Biology Department ##
## Institut Pasteur Paris ##
## ##
#########################################################################
# to get the log of the building:
# sudo docker run -ti --entrypoint bash <IMAGE_NAME>
# cat building.log
# to get all the ubuntu packages:
# sudo docker run -ti --entrypoint bash <IMAGE_NAME>
# apt-get update ; apt-cache policy procps libfontconfig1-dev gettext build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev libgit2-dev libcairo2-dev libxt-dev
# to get the table of the R packages installed:
# sudo docker run -ti --entrypoint bash <IMAGE_NAME>
# cat installed_r_packages.txt
# to export a file from the container:
# sudo docker container ls -a # to get all the active containers
# sudo docker cp <containerNAMES>:/building.log </host/path/target>
# base image: r-base:4.0.5
FROM gmillot/r_v4.0.5_extended_v1.0:gitlab_v6.3
# Warning: the name must be exactly what is written in the docker images interface, or sudo docker image ls. Here, the image is present locally, or distantly on the gmillot repo. Thus, gmillot/r-base:4.0.5 is correct.
LABEL Gael.Millot=gael.millot@pasteur.fr
LABEL gitlab.dockerfiles="https://gitlab.pasteur.fr/gmillot/dockerfiles"
ENV CRANREPO="'https://cran.irsn.fr/'"
ENV RLIB="\
'binb' \
'linl' \
'pinp' \
'tint' \
"
# The for last packages are for knitting
RUN echo "\n\n\n\n================\n\napt-get update\n\n================\n\n\n\n" > building.log \
&& apt-get update \
| tee -a building.log ; echo "\n\n\n\n================\n\napt-get install\n\n================\n\n\n\n" >> building.log \
&& apt-get install -y \
ghostscript=9.55.0~dfsg-3\
lmodern=2.004.5-6.1 \
pandoc=2.9.2.1-1+b2 \
pandoc-citeproc=0.17.0.1-1+b3 \
qpdf=10.5.0-1 \
# r-cran-formatr \
# r-cran-ggplot2 \
# r-cran-knitr \
# r-cran-rmarkdown \
# r-cran-runit \
# r-cran-testthat \
texinfo=6.8-3 \
texlive-fonts-extra=2021.20211217-1 \
texlive-fonts-recommended=2021.20211217-1 \
texlive-latex-extra=2021.20211217-1 \
texlive-latex-recommended=2021.20211217-1 \
texlive-luatex=2021.20211217-1 \
texlive-plain-generic=2021.20211217-1 \
texlive-science=2021.20211217-1 \
texlive-xetex=2021.20211217-1 \
# ghostscript=9.55.0~dfsg-3\
# lmodern=2.004.5-6.1 \
# pandoc=2.9.2.1-1+b2 \
# pandoc-citeproc=0.17.0.1-1+b3 \
# qpdf=10.5.0-1 \
# # r-cran-formatr \
# r-cran-ggplot2 \
# r-cran-knitr \
# r-cran-rmarkdown \
# r-cran-runit \
# r-cran-testthat \
# texinfo=6.8-3 \
# texlive-fonts-extra=2021.20211217-1 \
# texlive-fonts-recommended=2021.20211217-1 \
# texlive-latex-extra=2021.20211217-1 \
# texlive-latex-recommended=2021.20211217-1 \
# texlive-luatex=2021.20211217-1 \
# texlive-plain-generic=2021.20211217-1 \
# texlive-science=2021.20211217-1 \
# texlive-xetex=2021.20211217-1 \
| tee -a building.log \
&& RLIB_LENGTH=0 \
&& for i2 in $RLIB ; do RLIB_LENGTH=$((RLIB_LENGTH+1)) ; done \
&& COUNT=0 \
&& for i2 in $RLIB ; do \
COUNT=$((COUNT+1)) ; \
Rscript -e " \
options(warn = 1, verbose = TRUE) ; \
tempo <- file('building.log', open = 'a+b') ; \
sink(file = tempo, append = TRUE, type = 'message') ; \
message(paste0('\n\n\n\n================\n\nR PACKAGE INSTALLATION ', $COUNT, ' / ', $RLIB_LENGTH, ': ', $i2, '\n\n================\n\n\n\n')) ; \
install.packages(pkgs = $i2, lib = '/usr/local/lib/R/site-library', dependencies = NA, verbose = TRUE, repo = $CRANREPO) \
" ; \
done \
&& Rscript -e " \
options(warn = 1, verbose = TRUE) ; \
tempo <- file('building.log', open = 'a+b') ; \
sink(file = tempo, append = TRUE, type = 'message') ; \
message(paste0('\n\n\n\n================\n\nR PACKAGES INSTALLED\n\n================\n\n\n\n')) ; \
capture.output(as.data.frame(installed.packages())[1:4], file = tempo, append = TRUE, type = 'output') ; \
df <- as.data.frame(installed.packages()) ; \
for (i2 in 1:length(df)){ \
df[, i2] <- gsub(x = df[, i2], replacement = '', pattern = '\n', fixed = TRUE) \
} ; \
write.table(x = df, file = 'installed_r_packages.txt', row.names = FALSE, col.names = TRUE, append = FALSE, quote = FALSE, sep = ';') \
" \
&& echo "\n\n\n\n================\n\napt-get autoremove\n\n================\n\n\n\n" >> building.log \
&& apt-get autoremove -y \
| tee -a building.log ; echo "\n\n\n\n================\n\napt-get clean\n\n================\n\n\n\n" >> building.log \
&& apt-get clean \
| tee -a building.log ; echo "\n\n\n\n================\n\nrm\n\n================\n\n\n\n" >> building.log \
&& rm -rf /var/lib/apt/lists/* \
| tee -a building.log \
&& echo "\n\n\n\n================\n\ninstalled packages\n\n================\n\n\n\n" >> /building.log \
&& apt-cache policy \
ghostscript \
lmodern \
pandoc \
pandoc-citeproc \
qpdf \
# r-cran-formatr \
# r-cran-ggplot2 \
# r-cran-knitr \
# r-cran-rmarkdown \
# r-cran-runit \
# r-cran-testthat \
texinfo \
texlive-fonts-extra \
texlive-fonts-recommended \
texlive-latex-extra \
texlive-latex-recommended \
texlive-luatex \
texlive-plain-generic \
texlive-science \
texlive-xetex \
>> /building.log
# dependencies=NA means c("Depends", "Imports", "LinkingTo"). Do no use TRUE -> install suggesting packages which inflates tremendously the image.
ENTRYPOINT ["/usr/bin/R"]