new multi-stage docker file
This commit is contained in:
parent
0a98969c30
commit
33ceea0579
1 changed files with 18 additions and 9 deletions
|
|
@ -1,6 +1,13 @@
|
|||
FROM ubuntu:jammy
|
||||
FROM ubuntu:jammy as jags
|
||||
|
||||
ARG R_VERSION=4.4.1
|
||||
RUN apt update && apt install -y --no-install-recommends curl make ca-certificates gcc g++ gfortran liblapack-dev
|
||||
# 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
|
||||
|
||||
FROM ubuntu:jammy as final
|
||||
|
||||
ARG R_VERSION=4.4.2
|
||||
ENV PATH=/opt/R/${R_VERSION}/bin:$PATH
|
||||
ENV TZ="Europe/Berlin"
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
|
@ -10,6 +17,8 @@ ENV NCPUS=2
|
|||
|
||||
ARG GITHUB_PAT
|
||||
|
||||
COPY --link --from=jags /JAGS-4.3.2 /JAGS-4.3.2
|
||||
|
||||
# xvfb: for graphical pkgs requiring tcl, like gWidgets2tcltk
|
||||
# tcl tk tk-dev tk-table: must be available before running xvfb-run (i.e. starting the graphical session)
|
||||
# libmecab-dev: RcppMeCab -> no autodetection yet
|
||||
|
|
@ -17,9 +26,8 @@ ARG GITHUB_PAT
|
|||
RUN apt update && apt install -y --no-install-recommends gdebi-core g++ gfortran libbz2-dev libblas-dev libicu-dev liblapack-dev liblzma-dev libpaper-utils libpcre2-dev libtcl8.6 libtk8.6 libxt6 unzip zip zlib1g-dev libpcre3-dev libopenblas-dev curl ca-certificates make ccache htop libgit2-dev git libpq-dev libxml2-dev libgit2-dev cmake xvfb libcurl4-openssl-dev xz-utils tcl tk tk-dev tk-table pkg-config libmecab-dev libfftw3-dev automake
|
||||
|
||||
### 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 ..
|
||||
# JAGS
|
||||
RUN cd /JAGS-4.3.2 && make 2>&1 && make install 2>&1 >/dev/null && rm -rf JAGS-4.3.2 && cd ..
|
||||
# - Chromium should be auto-installed once pkgdepends merges the latest system-requirements rule changes
|
||||
RUN apt-get install -y software-properties-common && \
|
||||
add-apt-repository -y ppa:xtradeb/apps && \
|
||||
|
|
@ -36,14 +44,15 @@ RUN R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/
|
|||
# can't set ccache for gfortran because of https://gitlab.com/roigrp/solver/highs/-/issues/4
|
||||
RUN mkdir -p /root/.R && bash -c 'echo -e "CXX_STD = CXX14\nCFLAGS += -flax-vector-conversions\nCC=ccache gcc\nCPP=gcc -E\nCXXCPP=gcc -e\nCXX=ccache g++\nCXX11=ccache g++\nCXX14=ccache g++\nCXX17=ccache g++\nF77=gfortran\nFC=gfortran" >> /root/.R/Makevars'
|
||||
|
||||
RUN R -q -e "options(Ncpus = ${NCPUS}); packageVersion('pak'); pak::repo_get(); 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', 'future.callr', 'dbplyr'))"
|
||||
|
||||
# R repos
|
||||
RUN bash -c 'echo -e "options(encoding = \"UTF-8\", pkg.sysreqs_verbose = TRUE, crayon.enabled = TRUE, Ncpus = ${NCPUS}, future.globals.onReference = NULL, repos = structure(c(CRAN = \"https://cran.devxy.io/$ARCH/jammy/latest\", INLA = \"https://inla.r-inla-download.org/R/stable\")))" > ~/.Rprofile'
|
||||
|
||||
COPY --link . .
|
||||
RUN R -q -e 'dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)'
|
||||
RUN R -q -e "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', 'future.callr', 'dbplyr'))"
|
||||
|
||||
# COPY --link . .
|
||||
# remove secrets from COPY
|
||||
RUN touch /.Renviron /.envrc && rm /.Renviron /.envrc
|
||||
# RUN touch /.Renviron /.envrc && rm /.Renviron /.envrc
|
||||
RUN R -q -e 'pak::pak("git::https://gitlab.com/devxy/r-package-binaries/bincraftr.git")'
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
Loading…
Reference in a new issue