39 lines
No EOL
2.1 KiB
Text
39 lines
No EOL
2.1 KiB
Text
FROM alpine:3.20
|
|
|
|
ENV PATH=/opt/R/4.4.1/bin:$PATH
|
|
ENV TZ="Europe/Berlin"
|
|
|
|
# Background: JAGS needs lapack & lapack-dev but these conflict with openblas-dev which is required by R-dev
|
|
# Solution: first compile JAGS, then remove lapack & lapack-dev again
|
|
RUN apk add -q --no-cache curl tar make lapack lapack-dev blas blas-dev gcc gfortran g++ htop git
|
|
|
|
### 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 -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 && make && make install && rm -rf JAGS-4.3.2.tar.gz JAGS-4.3.2 && cd ..
|
|
RUN apk del lapack lapack-dev
|
|
|
|
# linux-headers: ps
|
|
# libxml2-dev: xml2
|
|
# libgit2-dev: gert
|
|
# libpq-dev: RPostgres
|
|
RUN apk add -q --no-cache R-dev curl ca-certificates bash g++ tzdata openjdk17 tar sed patch openblas-dev pkgconfig linux-headers ccache libxml2-dev libgit2-dev
|
|
|
|
# https://github.com/RcppCore/Rcpp/issues/448#issuecomment-220148774
|
|
# LDFLAGS+=-fPIC -> arrow (https://github.com/r-hub/r-minimal/blob/main/examples/arrow/Dockerfile)
|
|
RUN mkdir ~/.R && echo -e "CXXFLAGS+=-D__MUSL__\nCPPFLAGS+= -D__MUSL__\nLDFLAGS+=-fPIC" >> ~/.R/Makevars
|
|
|
|
### INSTALL R
|
|
RUN curl -O https://devxy-r-builds.s3.eu-central-2.amazonaws.com/alpine320/r-4.4.1_1_$(arch).apk
|
|
RUN apk add --allow-untrusted r-4.4.1_1_$(arch).apk && rm r-4.4.1_1_$(arch).apk
|
|
|
|
RUN R -q -e 'install.packages("remotes", repo = "cloud.r-project.org"); remotes::install_github("pat-s/pak@alpine")'
|
|
|
|
COPY . .
|
|
RUN apk add libxml2-dev
|
|
# FIXME: switch to pak after https://github.com/r-lib/pak/issues/628
|
|
RUN export ARCH=$(echo $(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')) && \
|
|
R -q -e 'Sys.setenv(PKG_SYSREQS = TRUE, PKG_SYSREQS_VERBOSE = TRUE); options(Ncpus = 4, repos = structure(c(devxy = sprintf("https://cran.devxy.io/%s/alpine320/latest", Sys.getenv("ARCH")), CRAN = "https://cloud.r-project.org"))); install.packages("remotes"); remotes::install_deps()'
|
|
RUN rm -rf r-pkg-binaries
|
|
|
|
CMD ["/bin/bash"] |