Hi everyone,
I am trying to install ggpubr and ggplot2 in the Docker container rocker/r-base from Docker Hub. Ggplot2 gets installed properly but ggpubr does not get installed. I tried to check for the package dependencies and to explicitly install them, but ggpubr is not the final image. This is my Dockerfile
# Install system dependencies
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libgit2-dev \
libcairo2-dev \
build-essential \
libxt-dev \
libgsl-dev \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev \
libfontconfig1-dev \
&& rm -rf /var/lib/apt/lists/*
# Install R dependencies
RUN R -e "install.packages('remotes', repos='https://cloud.r-project.org/')"
# Install devtools using remotes
RUN R -e "remotes::install_cran('devtools')"
# **Create a valid R package inside the container**
RUN R -e "usethis::create_package('/usr/local/src/rplotres', open = FALSE)"
# Install ggplot2 separately
RUN R -e "install.packages('ggplot2', repos='https://cloud.r-project.org/', dependencies = TRUE)"
#Install dependencies for ggpubr
RUN R -e "install.packages(c('ggrepel', 'grid', 'ggsci', 'stats', 'utils', 'tidyr', 'purr', 'dplyr','cowplot', 'ggsignif','scales', 'gridExtra', 'glue', 'polynom', 'rlang', 'rstatix', 'tibble', 'magrittr', 'grDevices', 'knitr', 'RColorBrewer', 'gtable', 'testthat'), repos='https://cloud.r-project.org/')"
###Check Development Tools: lines to ensure everything needed is there to building packages
RUN apt-get update && apt-get install -y build-essential
# Install ggpubr separately
RUN R -e "install.packages('ggpubr', repos='https://cloud.r-project.org/', dependencies = TRUE)"
# Install the R package
RUN R -e "devtools::install('/usr/local/src/rplotres')"
# Set the command to run R by default
CMD ["R"]
I am not really sure how to proceed from here. I would really like to use ggpubr. Is there any other docker container that has ggpubr already installed? rocker/tidyverse does not either.
Any suggestions?
Thanks.
Giulia
Adding to this point, the multiple
install.packages
layers have not only no advantage, but a HUEGE disadvantage: Each RUN adds a layer that inflates the container size.