FROM redhat/ubi9 ARG R_VERSION=4.4.1 ARG RED_HAT_DEV_PW ENV PATH=/opt/R/${R_VERSION}/bin:$PATH ENV TZ="Europe/Berlin" ENV ARCH=arm64 ENV NCPUS=2 ENV AWS_ACCESS_KEY_ID="" ENV AWS_SECRET_ACCESS_KEY="" ENV PGPASS="" ARG GITHUB_PAT RUN subscription-manager register --username mail@devxy.io --password "$RED_HAT_DEV_PW" && subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && dnf install -y epel-release # xvfb: for graphical pkgs requiring tcl, like gWidgets2tcltk # ImageMagick-c++-devel ImageMagick-devel: boths are not auto-installed via pak sysreqs RUN dnf install -y -q make lapack-devel git gcc gcc-c++ fontconfig-devel fribidi-devel libjpeg-turbo-devel libtiff-devel postgresql-devel htop libgit2-devel libxml2-devel hiredis ccache cmake xorg-x11-server-Xvfb tk-devel ImageMagick-c++-devel ImageMagick-devel xz ### CUSTOM DEPENDENCIES # These usually are not packaged in OS repositories and need to be installed from source # - JAGS (needed for runjags which itself is again a dependency of many packages) RUN curl -q -L -O https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.3.2.tar.gz && tar -xzf JAGS-4.3.2.tar.gz && cd JAGS-4.3.2 && ./configure --enable-silent-rules && make 2>&1 && make install 2>&1 >/dev/null && rm -rf JAGS-4.3.2.tar.gz JAGS-4.3.2 && cd .. ### INSTALL R RUN curl -O "https://devxy-r-builds.s3.eu-central-2.amazonaws.com/el9/R-${R_VERSION}-1-1.$(arch).rpm" RUN dnf install -q -y "R-${R_VERSION}-1-1.$(arch).rpm" && rm "R-${R_VERSION}-1-1.$(arch).rpm" RUN R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))' ### Makevars # dbarts: CFLAGS += -flax-vector-conversions (https://github.com/vdorie/dbarts/issues/66) RUN mkdir -p /root/.R && bash -c 'echo -e "CXX_STD = CXX14\nCFLAGS += -flax-vector-conversions\nCC=ccache gcc\nCPP=ccache gcc\nCXX=ccache g++\nCXX11=ccache g++\nCXX14=ccache g++\nCXX17=ccache g++\nF77=ccache /usr/bin/gfortran\nFC=ccache /usr/bin/gfortran" >> /root/.R/Makevars' # R repos RUN bash -c 'echo -e "options(crayon.enabled = TRUE, Ncpus = ${NCPUS}, future.globals.onReference = NULL, repos = structure(c(CRAN = \"https://cloud.r-project.org\", INLA = \"https://inla.r-inla-download.org/R/stable\")))" > /root/.Rprofile' RUN R -q -e 'Sys.setenv("PKG_SYSREQS_PLATFORM" = "redhat-9"); pak::pak(c("DBI", "R6", "RPostgres", "Rcpp", "askpass", "base64enc", "bit64", "bit", "blob", "callr", "cli", "credentials", "curl", "data.table", "desc", "digest", "dplyr", "fansi", "fs", "future.apply", "future", "generics", "gert", "globals", "glue", "hms", "httr", "jsonlite", "lgr", "lifecycle", "listenv", "lubridate", "magrittr", "mime", "openssl", "parallelly", "paws.common", "paws.storage", "pillar", "pkgbuild", "pkgconfig", "processx", "progressr", "ps", "purrr", "rlang", "rstudioapi", "s3fs", "stringi", "stringr", "sys", "tibble", "tidyselect", "timechange", "utf8", "vctrs", "withr", "xml2", "zip", "codetools", "cranlike", "RSQLite", "cachem", "crayon", "debugme", "fastmap", "memoise", "progress"))' COPY --link . . # remove secrets from COPY RUN touch /.Renviron /.envrc && rm /.Renviron /.envrc RUN R CMD INSTALL . && rm -rf r-pkg-binaries CMD ["/bin/bash"]