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 ### 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 # 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-003.backblazeb2.com/alpine320/r-4.4.1_1_arm64.deb RUN apk add --allow-untrusted r-4.4.1_1_aarch64.apk && rm r-4.4.1_1_aarch64.apk RUN R -q -e 'install.packages("remotes", repo = "cloud.r-project.org"); remotes::install_github("pat-s/pak@alpine")' COPY . . # FIXME: switch to pak after https://github.com/r-lib/pak/issues/628 RUN R -q -e 'Sys.setenv(PKG_SYSREQS = TRUE, PKG_SYSREQS_VERBOSE = TRUE); options(Ncpus = 4, repos = structure(c(devxy = "https://cran.devxy.io/arm64/alpine320/latest", CRAN = "https://cloud.r-project.org"))); install.packages("remotes"); remotes::install_deps()' RUN rm -rf arm-binaries-r CMD ["/bin/bash"]