make alpine dockerfile arch-agnostic

This commit is contained in:
Patrick Schratz 2024-09-04 22:38:55 +02:00
commit 125caa8a3e
Signed by: pat-s
GPG key ID: 3C6318841EF78925
5 changed files with 64 additions and 61 deletions

View file

@ -24,14 +24,15 @@ RUN apk add -q --no-cache R-dev curl ca-certificates bash g++ tzdata openjdk17 t
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_aarch64.apk
RUN apk add --allow-untrusted r-4.4.1_1_aarch64.apk && rm r-4.4.1_1_aarch64.apk
RUN curl -O https://devxy-r-builds.s3.eu-central-003.backblazeb2.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 . .
# 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
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 r-pkg-binaries
CMD ["/bin/bash"]

View file

@ -22,6 +22,6 @@ RUN R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/
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/rhel8/latest", CRAN = "https://cloud.r-project.org"))); install.packages("remotes"); remotes::install_deps()'
RUN rm -rf arm-binaries-r
RUN r-pkg-binaries
CMD ["/bin/bash"]

View file

@ -22,6 +22,6 @@ RUN R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/
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/rhel9/latest", CRAN = "https://cloud.r-project.org"))); install.packages("remotes"); remotes::install_deps()'
RUN rm -rf arm-binaries-r
RUN r-pkg-binaries
CMD ["/bin/bash"]

View file

@ -19,6 +19,6 @@ RUN R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/
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/jammy/latest", CRAN = "https://cloud.r-project.org"))); install.packages("remotes"); remotes::install_deps()'
RUN rm -rf arm64-binaries-r
RUN r-pkg-binaries
CMD ["/bin/bash"]

View file

@ -19,6 +19,6 @@ RUN R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/
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/noble/latest", CRAN = "https://cloud.r-project.org"))); install.packages("remotes"); remotes::install_deps()'
RUN rm -rf arm64-binaries-r
RUN r-pkg-binaries
CMD ["/bin/bash"]