From 0e458405e9a05796d49238b9b23fa0a93e2f83fc Mon Sep 17 00:00:00 2001 From: pat-s Date: Thu, 29 Aug 2024 16:38:09 +0200 Subject: [PATCH] add alpine docker file --- docker/Dockerfile-alpine-320 | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docker/Dockerfile-alpine-320 diff --git a/docker/Dockerfile-alpine-320 b/docker/Dockerfile-alpine-320 new file mode 100644 index 0000000..1c45e5d --- /dev/null +++ b/docker/Dockerfile-alpine-320 @@ -0,0 +1,37 @@ +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++ + +### 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-rbuilds.s3.eu-central-2.amazonaws.com/alpine320/r-4.4.1_1_aarch64.apk +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 . . +RUN R -q -e 'Sys.setenv(PKG_SYSREQS = TRUE, PKG_SYSREQS_VERBOSE = TRUE, PKG_SYSREQS_PLATFORM = "alpine"); pak::pak()' +RUN R -q -e 'Sys.setenv(PKG_SYSREQS = TRUE, PKG_SYSREQS_VERBOSE = TRUE, PKG_SYSREQS_PLATFORM = "alpine"); pak::pak("devtools")' +RUN rm -rf arm-binaries-r + +CMD ["/bin/bash"] \ No newline at end of file